Mikael Forssell scored his first Premiership goal in open play for two years to lift Birmingham out of the bottom three and wreck Robbie Savage's return to St Andrews with Blackburn.
Savage looked as if he had come back to haunt Birmingham by cancelling out Nicky Butt's opener with just 12 minutes remaining - his first goal for his new club.
But Forssell drilled home a cross from Julian Gray in the 87th minute to move Steve Bruce's side ahead of Portsmouth on goal difference.
Savage had already upset David Gold when he declined to shake hands with the Blues chairman before the game.
But his contribution on the field was the biggest dagger into the heart of Gold and Birmingham - until Forssell's late strike.
Birmingham's problem all season has been their inability to convert their opportunities and in the first half the otherwise impressive Chris Sutton was guilty of one of the misses of the season.
Rovers were also indebted to goalkeeper Brad Friedel for keeping them in the hunt during the opening 45 minutes against a pumped-up home side for whom Butt was a key figure in midfield.
The second half saw both sides have chances to wrap up all three points but no-one will begrudge Forssell his moment of glory after a succession of injuries which have dogged his career with City.