Stoke, into the semi-finals for the first time since 1972 thanks to Danny Higginbotham's winner, were drawn to face Bolton Wanderers at Wembley Stadium on either April 16 or 17.
Manchester United will face Manchester City or Championship side Reading in the other semi, with City playing Reading later on Sunday.
Stoke, who have been competing in the FA Cup for 128 years with little success, went ahead with a trademark goal after 12 minutes when Roberth Huth rose above the West Ham defence to powerfully head home a long thrown-in from Rory Delap.
West Ham, who beat Stoke 3-0 in the Premier League at Upton Park last week and also knocked them out of the League Cup in October, hit back 18 minutes later with a debatable equaliser.
Frederic Piquionne scored it after controlling the ball with his upper arm before lobbing it over Thomas Sorensen and bundling it into the net where he was injured by Huth and took no further part in the game.
The drama continued in the first minute after the break when referee Mike Jones controversially awarded Stoke a penalty after Scott Parker appeared to trip Matthew Etherington although TV replays suggested there was no contact.
The former West Ham winger picked himself up but saw his spot-kick well saved by Robert Green who dived to his left and palmed the ball away.
Stoke regained the lead after 63 minutes when Higginbotham smashed a free-kick through the West Ham wall and although Green got a hand to the ball and pushed it on to the post before he collected it again, it had clearly crossed the line.
"It was a very tough game and West Ham are a very good team as they showed last week when they beat us," Higginbotham told ITV Sport afterwards.
"But today, after getting the lead the second time we were able to stay ahead."
Stoke survived a call for a West Ham penalty when Hammers defender James Tompkins appeared to be hauled down in the penalty area late in the game.
Matthew Upson then headed against Stoke's bar with minutes remaining but Stoke held firm while West Ham are now left to concentrate on avoiding relegation from the Premier League.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.