Goalkeeper Lee Camp was Birmingham's hero as the Sky Bet Championship side clinched a place in the Emirates FA Cup fifth round on penalties against Coventry.
Camp saved penalties from substitutes Liam Walsh and Jamie Allen as Birmingham won 4-1 in a shootout after twice coming from behind in a 2-2 draw after extra-time.
Captain Harlee Dean's spot kick sealed victory, while substitutes Lukas Jutkiewicz, Jeremie Bela and Gary Gardner also netted from the spot to enable Birmingham to book a trip to Leicester in the last 16.
Dean made it 1-1 in the second minute of time added on, and a hopeful cross by Bela in the 120th minute saw Birmingham draw to cancel out goals from Amadou Bakayoko (50) and Max Biamou (114).
Mark Robins' visitors could have won in normal time but Biamou missed two excellent chances after Bakayoko's goal.
Birmingham carried little threat until the last few minutes of normal time, with goalkeeper Marko Marosi denying Jefferson Montero and Bela either side of half-time the highlights.
The home side also had former Chelsea midfielder Josh McEachran carried off with a suspected dislocated left knee in the 16th minute when the 26-year-old's studs appeared to get caught in the turf and his standing leg gave way.
Coventry twice went close early on. Bakayoko turned onto Fankaty Dabo's through ball with only Camp to beat, but could only fire weakly towards goal and Marc Roberts cleared.
Then Zain Westbrooke was inches wide with a skidding low shot.
Birmingham's first threat came from an overhead kick from Montero which required a goalline clearance from Dominic Hyam.
Coventry survived a penalty shout when a free-kick appeared to hit Biamou's arm in the 36th minute.
Birmingham forced the first save in the 40th minute when Montero's low drive hit the legs of Marosi.
But Coventry broke to force another chance, as Biamou's rising angled effort flew narrowly past the angle.
Bakayoko struck when he was left clean through by Westbrooke's ball through Dean's legs and his shot looped up off Camp and into the net.
The Sky Blues should have doubled their lead in the 58th minute.
Dabo's cross was met by Biamou, but he ballooned well over the bar.
Biamou had another chance to seal Coventry's place when Allen left him through on goal, but he sidefooted inches wide with only Camp to beat.
Almost immediately, Blues had a chance through Bela, but Marosi made a superb block.
Dean glanced home Bela's cross at the death and there was still time for substitute Jutkiewicz to head against the bar before extra-time.
Biamou tapped home after substitute Callum O'Hare - who missed a sitter in the first game - crossed.
But amazingly, Birmingham levelled for a second time when Bela's hopeful deep cross went in off the far post to force penalties.