On an emotionally-charged night in east London, it looked as though Anthony Martial’s double had ruined the Hammers’ party but late headed goals from Michail Antonio and Winston Reid secured the win that almost took the roof off the old stadium.
As the home team did a lap of honour and the fans broke into a stirring rendition of their ‘I’m forever blowing bubbles’ anthem, Man United’s players slipped away to contemplate what now looks like a failed mission to secure Champions League football next season.
West Ham’s final competitive fixture at their Upton Park home since 1904 threatened to turn sour before kickoff when Manchester United’s team bus was damaged by a barrage of bottles thrown by home supporters blocking all the roads outside the stadium.
It caused a 45-minute delay to the start and the away side were clearly unsettled by their hostile welcome as West Ham dominated the first half.
The hosts went ahead after 10 minutes when Diafra Sakho swept the ball home from Manuel Lanzini’s cut back.
Andy Carroll spurned a great chance to make it 2-0 while Antonio had a goal ruled out.
Manchester United sent on former West Ham midfielder Michael Carrick after the break to try and instigate a comeback.
The visitors did improve and were level after 51 minutes when Marcus Rashford and Juan Mata combined to set up Martial.
Dimitri Payet and Sakho went close to putting West Ham back in front but United struck on the break when Martial’s shot embarrassed keeper Darren Randolph at the near post.
Manchester United’s lead lasted four minutes though as playmaker Payet picked out Antonio who thumped a header past keeper David de Gea.
With the atmosphere building to a crescendo, West Ham snatched victory in their 2,398th and final game at Upton Park when Reid’s header beat De Gea’s despairing attempt to keep the ball out.
The roars would have been heard down the road at the Olympic Stadium where sixth-placed West Ham could host Europa League matches next season if they finish with another win at Stoke City on Sunday.
Manchester United, who are fifth, must now beat Bournemouth in their final game on Sunday and hope Manchester City lose at Swansea City in order to reach the top four.