The visitors needed to record victory to maintain pace with Southampton, who were five points clear ahead of kickoff.
Hammers skipper Kevin Nolan came even closer to opening the scoring, but his effort across goal narrowly missed the post.
Beckford was presented with another headed chance minutes later and this time he took it, as he nodded home unmarked on 33 minutes.
West Ham's response was almost immediate, as Matt Taylor's low fizzing ball into the box was converted by unlikely goalscorer Winston Reid five minutes later.
With the scores level at the break, West Ham went pushing for a winning goal and found it courtesy of Jack Collison.
The Wales international struck into the bottom corner past Kasper Schmeichel in the Foxes net to make it 2-1 just short of the hour mark.
The hosts could have found an equaliser late on but Danny Drinkwater couldn't capitalise on Julien Faubert's poor defensive header as he lashed a shot over the bar.
Sam Allardyce's side now need to beat Hull City on the final day of the season and hope that the Saints lose to already relegated Coventry City if they are to return to the Premier League at the first attempt.