Spurs midfielder Michael Carrick spared Robbie Keane's blushes with the winning goal as Sunderland's bad run continued.
The visitors took a surprise lead from a stunning Dean Whitehead free-kick but Mido levelled from close range.
Mido flicked on for Keane, who capitalised on some slack defending to score before substitute Anthony Le Tallec sidefooted an equaliser.
Ben Alnwick brilliantly denied a Keane penalty but Carrick slotted the winner 13 minutes from the end.
The win coupled with Arsenal's defeat at Bolton means Spurs go back ahead of their north London rivals as they continue their best start to a Premiership season.
Tottenham dominated the game almost from kick-off, passing the ball fluently and patiently looking for an opening.
The away side, who have now lost nine in a row, set out their stall to sit back and try and absorb the pressure.
But it looked only a matter of time before Martin Jol's side broke down Sunderland's resistance and Teemu Tainio tested Alnwick early on with a thumping shot that the teenage keeper managed to beat away.
When the opening goal came it seemed to stun everyone in the ground, especially the visiting fans who have become accustomed to seeing their side fall behind.
Michael Dawson fouled Jon Stead 30 yards from goal and from the free-kick Whitehead's powerful, curling effort escaped Paul Robinson's outstretched arm and nestled in the top corner.
Tottenham almost answered immediately but the ball just failed to fall for Keane two yards out.
Mido levelled eight minutes before the break when the Sunderland defence allowed Keane far too much space and his cross found his strike partner to slide in and score his fifth of the season.
The Egyptian twice came close to adding another before the interval with a powerful header from a Carrick corner and then a shot from the edge of the box after turning Gary Breen.
Six minutes after the break Spurs edged in front with a scrappy goal that was awarded to Keane.
Mido flicked on a long ball and Keane capitalised on some indecision from Alnwick and Danny Collins to prod home, although it looked like Collins' head may have got the last touch.
It was all set up for Spurs to put Sunderland away, but they took their foot off the gas and the visitors showed the sort of drive and determination so often missing this season.
Tottenham should have gone back in front when referee Peter Walton awarded them a 71st-minute penalty for a handball by Gary Breen.
It looked a poor decision but Alnwick came to the rescue with a fine save to palm away Keane's effort.
Sunderland looked to hold on but again they allowed acres of space down the left and Carrick had time to pick his spot and casually stroke home the winner.
Tottenham boss Martin Jol:
"I'm delighted. It's always hard when you fall behind. It was a great free-kick but then we fought back and showed a great mentality.
"They were eager, ambitious and are fighting for their lives. So teams like Sunderland can always score a goal.
"It was a great first touch by Michael Carrick and it was nice to see him score. I think we deserved this win."
Sunderland boss Mick McCarthy:
"It was a much better performance but we've still lost - that's the disappointing thing.
"They were more willing to get on the ball and we played a lot better than we have at home recently.
"The defending left a lot to be desired still. We played three centre-backs and we still conceded three goals - we should have stopped them."
Tottenham: Robinson, Stalteri, Dawson, King, Lee, Jenas (Lennon 63), Carrick, Davids, Tainio, Mido, Keane (Defoe 74).
Subs Not Used: Cerny, Pamarot, Reid.
Goals: Mido 37, Keane 51, Carrick 77.
Sunderland: Alnwick, Collins, Breen, Caldwell, Nosworthy, Whitehead, Bassila, Woods (Lawrence 63), Hoyte, Stead (Le Tallec 54), Brown (Gray 33).
Subs Not Used: Davis, Welsh.
Booked: Breen, Nosworthy.
Goals: Whitehead 16, Le Tallec 60.
Ref: P Walton (Northamptonshire).