Ten-man Manchester City pulled off an amazing FA Cup comeback to earn a fifth round tie at Manchester United.
Tottenham led 3-0 at half-time after Ledley King curled the opener, Robbie Keane slid in Stephen Carr's pass and Christian Ziege fired in a free-kick.
City's Joey Barton was sent off for a second booking but Sylvain Distin got a goal back and Paul Bosvelt gave them hope with a deflected shot.
Shaun Wright-Phillips levelled before Jonathan Macken headed a late winner.
There was little to hint at the epic game ahead at half-time.
2 mins: Ledley King opens the scoring
19 mins: Robbie Keane doubles the lead
43 mins: Christian Ziege scores a sublime free-kick
45 mins: Joey Barton is sent off for dissent
48 mins: Sylvain Distin gives Man City hope
69 mins: Paul Bosvelt scores with a wicked deflection
80 mins: Wright-Phillips nets a wonderful equaliser
90 mins: City celebrate as Macken heads in the winner
Spurs had shown all the attacking flair and looked to be coasting into the next round.
King gave them the initiative on two minutes after a half-clearance fell to him on the edge of the area.
The midfielder superbly controlled the ball and created a yard of space before bending the ball into the top corner past City debutant Arni Arason.
Keane scored next, controlling a long ball up field from Carr with his right foot before dinking the ball exquisitely home with his left.
And Manchester City's plight worsened when Nicolas Anelka limped off with a groin injury and was replaced by Macken.
When Ziege bent a superb free-kick into the top corner, the tie looked a formality, especially when City were reduced to 10 men.
Barton had already been booked for a late challenge when he shown a second yellow card for dissent seconds after the half-time whistle sounded.
The balance shifted in City's favour on the restart.
Defying their numerical disadvantage, the visitors showed signs of life.
A clever free-kick from Michael Tarnat found Distin, who headed home from eight yards.
Bosvelt then pulled a second goal back, but not without a huge measure of luck.
He fired in a shot that looked to be going wide before it took a huge deflection off Anthony Gardner.
There were question marks over City's equaliser, with Wright-Phillips latching on to a hopeful ball from what looked to be an offside position.
But there was no doubt about the winner, which came only seconds from time.
From Tarnat's cross from the left, Macken's header looped over Keller and into the back fo the net.
Tottenham: Keller, Carr, Richards, Gardner, Ziege (Jackson 60), Dalmat, King, Brown, Davies, Postiga (Poyet 9), Keane.
Subs Not Used: Burch, Yeates, Kelly.
Man City: Arason, Jihai, Dunne, Distin, Tarnat,
Wright-Phillips, Barton, Bosvelt (Sibierski 80), Sinclair (McManaman 80), Fowler, Anelka (Macken 27).
Subs Not Used: Stuhr-Ellegaard, Jordan.
Sent Off: Barton (45).
Booked: Barton, Bosvelt, Jihai.
Referee: R Styles (Hampshire).