Two late goals from Matthew Barnes-Homer saw Macclesfield of the Conference come from behind to pull off a stunning turnaround here and beat the Championship pacesetters Cardiff City.
Steve King's mid-table side, who had already knocked out League One's Swindon in this season's Cup competition, were trailing before Barnes-Homer fired home at the far post in the 85th minute, and he powered a penalty past Joe Lewis three minutes later to spark scenes of wild celebrations.
"People wrote Barnes-Homer off but I believed in him," said King. "Matthew is an unusual character sometimes but I know how to get the best out of him. That's 20 goals he's scored now, and time and time again he's dug us out. I said before the game that sometimes you won't see him and then bang, he'll score.
"He's not for sale and we are in the process of [negotiating] a new contract for him. He's earned it. He took a huge wage cut to come here so he deserves it."
Nathaniel Jarvis, making his first full start for Cardiff, appeared to have given the much-changed Bluebirds victory when he scrambled the ball home in the 57th minute.
The visitors, who finished the match with seven teenagers on the pitch, did indeed have chances to finish the job before Barnes-Homer took his goal haul to 20 for the season and sent the underdogs through.
The Cardiff manager Malky Mackay made 11 changes to the side that beat Millwall, and Jarvis, having already played against Macclesfield this season for Forest Green, had the ball in the net early on. But play was called back for a foul by his strike partner Etien Velikonja.
In an even opening to the match Macclesfield had sight of goal themselves with Charlie Henry forcing a save from Joe Lewis with a shot from 20 yards. As the game reached the half-hour mark, Cardiff's defender Ben Nugent had a header saved by Lance Cronin after Adedeji Oshilaja's cross found the centre-back. Three minutes later Henry missed a glorious chance to open the scoring when he found himself unmarked but failed to test Lewis from six yards.
Macclesfield, started brightly in the second half, Amari Morgan-Smith having a shot blocked by Nugent two minutes after the break. But the Bluebirds took the lead against the run of play with a fine move finished off by Jarvis from close range after good work from Declan John. The Welshman, on his full debut, pulled a pass back into Jarvis's path at the end of a left-wing run.
Stephen McPhail, captaining Cardiff in only his second appearance of the season, went close to making it 2-0 a minute later but Cronin saved the former Leeds midfielder's 20-yard effort.
Just when it looked as if Cardiff were easing through, Jack Mackreth crossed from the right and Barnes-Homer met it with a left-footed finish from six yards out with five minutes left.
The match was decided in the 88th minute when referee Andrew Madley pointed to the spot for a foul by Jarvis on Barnes-Homer. The club's top-scorer composed himself before knocking Cardiff out of the Cup.
Mackay did not regret his choice of players: "We picked a team we felt was capable of winning and I thought there were some fantastic performances. They got to five minutes to go but switched off and that lost us the game – they will learn from that."