League One side MK Dons appeared to be on the verge of a second-round scalp after Patrick Bamford scored on seven minutes and Izale McLeod increased the lead on 55 minutes.
Jozy Altidore pulled one back on 78 minutes before substitute Connor Wickham's brace and an Adam Johnson goal in the closing three minutes sent Sunderland into the third round.
Bamford on loan from Chelsea, blasted the visitors into a seventh-minute lead with his third goal in four games thanks to a rasping long-range drive.
It could have been even worse for the Black Cats, who needed keeper Vito Mannone to keep out a glancing header from team-mate Cabral and enjoyed a rare slice of good fortune when striker McLeod fired just wide inside a turbulent opening 20 minutes.
For their part, Sunderland created little of note, despite right winger Johnson and striker Altidore causing problems, with midfielder David Moberg-Karlsson and Ji Dong-won in particular struggling to make an impact.
But the Swede might have marked his first competitive appearance with an equaliser after Altidore's 44th-minute shot had come back off a post, only to miss his kick and then head tamely at keeper Ian McLoughlin from the rebound.
Whatever he said in the dressing room at half-time, Di Canio sent out the same 11 men for the second half and saw them almost fall further behind with barely a minute played.
Bamford caused problems down the right once again before laying the ball off for skipper Stephen Gleeson to blast a right-foot drive inches over the angle of crossbar and post.
But Sunderland did fall further behind within 10 minutes of the restart when McLeod produced the cheekiest of finishes to extend his side's lead and put them within touching distance of victory.
A much-changed Sunderland, who misfired badly for much of the contest, gave themselves a lifeline with 12 minutes remaining when Altidore made the most of Wickham's through-ball to claim his first goal for the club, but the fireworks had only just begun.
Wickham, who replaced Ji, dashed MK Dons' hopes of hanging on to their lead when he converted full-back Ondrej Celustka's cross four minutes from time and the tie looked to be heading into extra-time.
But the former Ipswich striker snatched even that crumb of comfort from Karl Robinson's men when his 89th-minute shot deflected off defender Ben Reeves and flew past wrong-footed keeper Ian McLoughlin.
In the space of 11 minutes, the mood inside the Stadium of Light had altered dramatically, and there was more to come for the home fans six minutes into added time when Johnson cut in from the right and drilled home a fourth from the tightest of angles.