Gary Gardner stepped off the bench to bag an 85th-minute winner as Birmingham beat Preston 2-1 at Deepdale.
Debutant Riley McGree gave the Blues the lead after just two minutes with a clinical strike before striker Jayden Stockley equalised for North End with a stunning 30-yard volley.
Gardner then headed home at the death to secure a second Sky Bet Championship win on the bounce for the Blues.
Preston sit 16th in the table having suffered a second successive defeat, their fifth in nine games so far this season.
Both managers made five changes to their starting sides, Alex Neil shuffling the Preston pack after a midweek defeat to Millwall and City boss Aitor Karanka also opting for wholesale changes.
It was the visitors who had the best possible start when McGree fired them ahead in only the second minute.
Josh Harrop lost the ball and Preston keeper Declan Rudd thwarted striker Jonathan Leko with a superb point-blank save.
But the ball ran free and Lukas Jutkiewicz picked out McGree with an acrobatic bicycle-kick and the midfielder rifled into the bottom right corner for the perfect beginning.
Leko had a powerful shot charged down in the box as the visitors pressed to double their lead, before Stockley levelled for Preston with a stunning strike.
The striker found himself with plenty to do from distance, but he calmly took the ball down on his chest and picked out the top left corner with a thunderbolt.
Skipper Alan Browne had a good chance for the home side shortly after the half hour mark, but he rifled straight at City keeper Neil Etheridge.
Josh Dacres-Cogley blasted over just before half-time and, at the other end, Harrop nearly made amends for his early mistake, only to shoot over with a right-foot strike.
Rudd blocked Mikel San Jose's header soon after the restart, while Preston winger Tom Barkhuizen was denied a goal by a stunning save from Etheridge.
The keeper saved athletically one-handed and Browne headed over moments later.
Browne again shot wide as Preston kept pushing for the lead and also had an effort saved by Etheridge.
But the home side were hit with a sucker-punch when replacement Gardner scored with his first touch having only just come on the pitch.
The midfielder jumped tallest to head San Jose's pinpoint cross past a helpless Rudd.
Etheridge spared Birmingham's blushes with a stunning fingertip save from Barkhuizen with just two minutes remaining.