Hammers striker Andy Carroll opened the scoring in the fifth minute of Barclays Premier League contest with his first goal of the season, rising above Peter Crouch and crashing a header past Asmir Begovic, who had rushed off his line to try to punch the ball away.
The hosts equalised in the 32nd minute when Crouch, following up his own header that had hit the bar, saw his acrobatic effort go in off the shoulder of Peter Odemwingie.
Kevin Nolan thought he had made it 2-1 to the visitors when he put the ball in the net in the 61st minute, but the effort was ruled out for offside.
And Stoke subsequently went on to wrap up victory, with Marko Arnautovic getting through a crowd of players and slotting in on 69 minutes before Odemwingie finished a Potters counter-attack by lashing home with 11 minutes to go.
Early on, it appeared as if the day might belong to Carroll.
Since becoming West Ham's record signing last summer, Carroll has endured a frustrating campaign, missing much of it due to a foot injury and then, after finally regaining his fitness, being hit with a three-match suspension for a red card in February.
He is still hoping to make England's squad for this summer's World Cup, though, and on what was his first start since his sending-off and only his seventh appearance of the season, he looked like a man on the mission as this game got under way.
The 25-year-old, who was on loan with West Ham from Liverpool last term and last scored in April, had already had a shot blocked when he headed the Hammers into the lead
Carroll connected with Mark Noble's floated free-kick as his marker Crouch and Begovic got in each other's way.
Stoke were almost level immediately as Adrian tipped a Stephen Ireland effort around the post, but Carroll was soon threatening again, bringing a save out of Begovic.
The action switched to the other end again as Steven Nzonzi's shot was blocked and from the resulting corner, Marc Wilson sent an effort goalwards that went behind off Odemwingie.
Stoke were forced into a substitution just before the quarter-hour mark as Erik Pieters went off for Marc Muniesa, and the game then reduced in tempo somewhat after its frantic opening.
Arnautovic earned a corner with an ambitious effort, and Crouch then did the same, leading to the Potter's leveller.
From Ireland's corner, Crouch nodded the ball into the ground and onto the bar, and then reacted quickly to volley it back goalwards.
It struck Odemwingie, who was on the line, before going in, but Crouch might feel the goal should be his.
Carroll was still on the hunt and cracked a shot over the bar as half time approached, before Ireland failed to make the most of being put through on goal, shooting straight at Adrian.
Shortly after the restart Nolan headed Mohamed Diame's cross wide from a good position and Crouch then just failed to make connection with a clever through-ball as he tried to nick it past Adrian.
Carroll was next to find himself in space in front of goal, but saw his shot divert over via Begovic's foot.
Then came the offside decision, as Begovic punched the ball out, it came back into the box to Nolan and he guided it into the net. Much to his dismay, the flag was up.
Stoke soon capitalised after surviving that scare, as Arnautovic collected the ball, squeezed into the box past several West Ham men and beat Adrian.
And after West ham had had a couple of handball claims waved away, Odemwingie made the three points safe with a goal that was certainly his, smashing in emphatically from Ireland's pass as Stoke surged forward on the break.