Sunderland substitute Tommy Smith lined up an FA Cup quarter-final at home to fellow Division One side Sheffield United by hitting an extra-time double.
Cup hero Smith replaced the luckless Stewart
He had replaced Marcus Stewart, who missed a golden opportunity to sink Premiership outfit Birmingham when he headed wide from a John Oster cross.
Smith scored from a rebound after Kevin Kyle had hit the bar and fired in again after a one-on-one with Maik Taylor.
The Blues lost David Dunn because of a hamstring injury in the 10th minute.
Dunn, who had only recently returned to action, had initially come into the side at the expense of Stephen Clemence after Birmingham boss Steve Bruce decided to keep faith with the side that finished the 2-2 draw with Aston Villa in the Premiership derby at the weekend.
Sunderland had the first real chance in the second minute when Kyle found Stewart in space eight yards out but he failed to make full contact and his left-foot effort was saved by Maik Taylor.
Birmingham's Clinton Morrison fired over the bar in the fourth minute and Gary Breen cleared a free-kick from Robbie Savage three minutes later.
Visiting goalkeeper Mart Poom then caught an 18-yard effort from Morrison and he also thwarted Bryan Hughes from a similar distance.
Sunderland's former Ipswich striker Stewart was caught offside on a few occasions in the first half and both sets of fans voiced their displeasure at a number of such decisions.
Jeff Whitley cleared a Savage corner and Morrison deflected a header wide from an Oliver Tebily cross.
Tebily was in the thick of the action again soon afterwards but dragged a shot wide of a post and the impressive Morrison had another effort blocked by Poom.
Phil Babb went close for the visitors in the 58th minute after John Oster had sent over an inswinging corner and another corner from Julio Arca was caught by Taylor.
Kyle tried his luck from 18 yards before the out-of-sorts Stewart was replaced by Smith on the hour.
A foul on Tebily by Arca led to a right-footed free-kick by Savage but Darren Purse's header was well wide and a free-kick from Kenny Cunningham was dealt with by Poom.
However, in extra time the deadlock was broken by Smith when he reacted quickly to a goalmouth scramble that came after Kyle crashed an effort against the crossbar.
And 16 minutes later he again sent the Sunderland faithful into raptures when he found himself unmarked and bearing down on goal and Blues keeper Taylor could do nothing to thwart Smith as he slipped the ball into the corner of the net.
Sunderland's Stephen Wright also went close during the additional half-hour, Kyle blasted over the bar from 18 yards and Birmingham's Stern John saw a header go wide.
Savage had a right-footed free-kick saved by Poom but by then Sunderland had already sealed their place in the last eight of the competition for the first time in 12 years.
Birmingham: Maik Taylor, Tebily (John 71), Cunningham, Purse,
Kenna, Johnson, Savage, Hughes, Dunn (Clemence 10), Forssell,
Morrison, Clemence (Carter 96).
Subs Not Used: Bennett, Cisse.
Sunderland: Poom, Wright, Babb, Breen, McCartney,
Oster (Thornton 104), Thirlwell, Whitley, Arca, Kyle,
Stewart (Tommy Smith 62).
Subs Not Used: Ingham, Williams, Cooper.
Referee: M Dean (Wirral).