West Ham must wait to see if they will secure European football next season as Mame Biram Diouf's late header earned Stoke victory at the Britannia Stadium.
Michail Antonio's turn and shot gave Slaven Bilic's side the lead as they totally dominated the first half.
Giannelli Imbula equalised with a 20-yard effort before substitute Diouf powered home a Charlie Adam corner.
West Ham finish seventh and, in order to qualify for the Europa League, need Manchester United to win the FA Cup.
Stoke finish ninth for the third successive season.
Southampton's victory over Crystal Palace ensured they leapfrogged the Hammers.
Relive Stoke's victory here.
Follow all the reaction to the final day of the Premier League here.
After the high emotion of Tuesday night's goodbye to Upton Park, West Ham did not appear to suffer any hangover as they created all the chances in the first half - yet still ended up losing.
Knowing a victory would secure at least a sixth-place finish, the visitors took the lead when Antonio held off the Stoke defence at a corner and fired past Shay Given.
The winger then shot over and Diafro Sakho found the side-netting with Stoke, winless in six games, offering no threat of their own.
Mark Hughes' men at least woke up after the break but Sakho should have made it 2-0 when he side-footed at Given after another fine run by the excellent Antonio.
Even after Stoke's equaliser, Given made a brilliant double save from Enner Valencia and Emmanuel Emenike, while Glenn Whelan just about cleared off the line from Cheikhou Kouyate.
The goal review system showed only a tiny fraction of the ball had not crossed the line. On such small margins can European qualification rest.
Stoke ended last season with a 6-1 demolition of Liverpool at the Britannia Stadium, scoring five of them in the first half. Here, they managed only one shot in the opening 45 minutes.
It could only get better after the break and, although there was a significant improvement, they were still fortunate to equalise when record signing Imbula picked out the bottom right-hand corner after running across the box.
West Ham had 20 shots to Stoke's seven but, after failing to win in six matches, the Potters dug in to keep the visitors out as chances mounted up at 1-1.
Diouf's 88th-minute header gave them an unexpected reward and a first win in seven league games.
West Ham boss Slaven Bilic: "Basically, the most important thing today was to win no matter how and that we didn't do. We're disappointed to lose sixth place in the last game of the season. But it was still a great season for us. It makes us proud.
"I'd like to congratulate Stoke - they took their chances. But it is hard to take this defeat. For the whole game we played much better football. You have to take 50% of your chances. I said to my players at half-time if it was basketball we would be 20 points clear.
"Despite losing, I'm happy because we played really good football and were totally dominant in a difficult game."