Jay Stansfield's late penalty at Bristol Rovers made it a sensational six wins on the bounce for Birmingham to leave them on the brink of promotion.
The Blues, unbeaten at home all season, need just eight points from their final eight games to go up as champions.
Barnsley's season goes from bad to worse with the midweek defeat against Exeter leaving them closer to Mansfield in 17th than the play-offs.