Tottenham's Premiership campaign ended in agony as Arsenal beat them to fourth and a place in the Champions League.
Needing a victory to be sure of fourth, Spurs made a disastrous start when they went behind after 10 minutes to Carl Fletcher's fizzing 30-yard shot.
Jermain Defoe responded with a stunning effort and Paul Robinson saved Teddy Sheringham's penalty to lift Spurs.
However, Yossi Benayoun found space for a late winner and that, coupled with Arsenal's win, sealed Tottenham's fate.
The Gunners' 4-2 victory in the last game at Highbury confirmed their qualification for next season's Champions League, while Spurs must settle for the Uefa Cup.
The game at Upton Park had been in doubt ahead of the kick-off after several Spurs players had come down with food poisoning.
However, the game went ahead and with Spurs' defence looking distinctly off colour, West Ham took full advantage in a pulsating opening spell.
Nigel Reo-Coker and Benayoun went close before Fletcher made the breakthrough.
The 26-year-old, looking to win a place in Alan Pardew's FA Cup final team, won the ball in midfield and beat Robinson from 30 yards for his first ever Premiership goal.
Sheringham almost made it two with a curling cross-shot but as the Hammers committed numbers in attack, Tottenham almost hit back.
A sweeping move ended with a desperate block by Anton Ferdinand as Aaron Lennon looked to find Defoe, and Teemu Tainio should have done better with a free header from a corner.
But after a furious start, the game had settled into a more sedate pace when the Spurs fans suddenly began celebrating as news reached them of Wigan taking a 2-1 lead at Highbury.
And they were still cheering when Defoe, whose every touch had been booed by his former club's fans, gave England boss Sven-Goran Eriksson a timely reminder of his qualities, turning Danny Gabbidon and firing inside the far post.
But with Arsenal making it 2-2 before half-time, the Spurs' fans experienced a tense interval and their nerves were hardly eased when Tainio clattered into Bobby Zamora six minutes after the break.
Sheringham, a former White Hart Lane favourite, scuffed his penalty and Robinson easily collected but the visiting fans' delight did not last long.
First the irrepressible Zamora, another former Spurs player, took advantage of yet more slack defending to race through on goal only to be denied by a last-ditch tackle and then Arsenal took the lead at Highbury.
Tottenham sensed the urgency and Keane shot wide and then saw Shaka Hislop save well, before Tainio dragged a shot wide.
But as the minutes ticked by, Reo-Coker's backheel found Benayoun, who sidestepped Michael Dawson and fired into the top corner.
Keane went high and wide with a late free-kick to sum up a disastrous day for Tottenham, whose fans were forced to listen to the jubilant taunts of the West Ham support.