West Ham manager Manuel Pellegrini applauds fans before the match
The Hammers may be 10th in the Premier League and Wimbledon rock bottom of third-tier League One, but that didn't stop them going 3-0 down in this all-London tie, with Scott Wagstaff scoring twice after Kwesi Appiah's opener.
West Ham manager Pellegrini sent on substitutes Lucas Perez and Felipe Anderson after the break, with both players scoring to make it 3-2.
But Wimbledon teenager Toby Sibbick settled the match just moments after coming on by heading in the goal that ended all hope of a Hammers fightback two minutes from time.
"Was I angry at half-time? Yes of course. I was ashamed of them," said Pellegrini.
"I didn't expect it, the attitude, playing against a team that sits two divisions below us, but in football, you can lose in two or three balls.
"They started the way we needed to start and when you have such high pace with the quality of the players and we didn't have the same level," the Chilean added.
Marko Arnautovic was left out of the squad completely following the recent saga of whether he would make a lucrative move to China during the transfer window.
Yet just 10 minutes after Saturday's shock loss, the Hammers confirmed the Austrian forward had signed a new contract - although they did not say for how long.
Pellegrini, decidedly unimpressed by the speculation over Arnautovic's future, refused to discuss the announcement of a new deal.
"Ask me about the game today and I will answer," he told reporters. "Any other question I will not answer."
Meanwhile an elated Sibbick was left savouring one of the best days of his fledgling career as Wimbledon revived memories of the "Crazy Gang" era that saw them win the 1988 FA Cup - long before their 19-year-old rising star was born.
"It is probably one of the highlights for me, scoring against Premier League opposition," Sibbick told BT Sport.
"We thought we were unlucky in the League Cup (West Ham scored two late goals to beat Wimbledon 3-1 in August) and got our revenge tonight."
Two-goal hero Wagstaff added: "I thought the boys were excellent. It's a great win - look at the fans. This is what it is all about.
"We need to make sure we do that now every week. It's not been good enough this season from us and we know that."
Meanwhile Wimbledon manager Wally Downes, a former Hammers coach, said: "The result was the plan, but it certainly wasn't my idea to go and win 4-2!
"What was important for the players was they got over the performance they put out on Tuesday night (when they lost 3-0 at home to Fleetwood)."
Downes, who as a player helped Wimbledon climb from English football's fourth tier all the way to the old First Division, the forerunner of the Premier League, added: "There is a load of analysis that we (coaches) do, and I'm part of that, but football is random and on any given day, any team can beat any other team.
"We used to do it all the time, and we've done it tonight."