Match ends, Bristol City 1, Birmingham City 2.
Connor Mahoney scored one goal and created the other as Birmingham City beat Bristol City to move to within three points of the Robins in the Championship play-off places.
Both sides had early chances, with Andreas Weimann denied by Blues goalkeeper Lee Camp before Kerim Mrabti tested Niki Maenpaa and Che Adams then crashed an effort off the underside of the bar at the other end.
On-loan Bournemouth winger Mahoney put the visitors ahead just before the break with only the second goal of his career on his 50th league appearance.
After his heavily deflected shot wrong-footed Maenpaa, he then turned provider in the second half when his free-kick was headed home by Michael Morrison.
Famara Diedhiou pulled a goal back with a tap-in to set up a dramatic climax at Ashton Gate but, despite relentless late pressure, Bristol City lost at home for the first time in eight league matches.
Birmingham, who have had a hearing over their breach of spending rules delayed until mid-March as speculation about a potential points penalty persists, move up to eighth in the table with their 12th league win of the season.
Robins boss Lee Johnson had to watch from the stand, where he served a one-match touchline ban, as the hosts slumped to their third straight defeat in all competitions.
Weimann carved out the first real chance, meeting a ball from Adam Webster before forcing Camp to turn his effort around the post.
Moments later Maenpaa was called into action, reacting well to keep Mrabti out, but the keeper could only look on soon after as the bar was all that denied in-form striker Adams his 11th goal in nine Championship games.
Diedhiou then wasted a glorious a chance for the hosts, and it was one that Blues punished with Mahoney squeezing home the opener before the break and Morrison doubling the advantage just two minutes into the second half.
The backtracking Tomas Kalas ensured Blues did not make it 3-0 just after the hour, clearing the danger as Adams looked to roll the ball into an empty net after rounding the keeper.
And while a poked finish from Diedhiou gave the hosts renewed impetus, it was not enough as the Robins suffered their second defeat in four days after their seven-game winning league run was ended by leaders Norwich on Saturday.
Bristol City boss Lee Johnson told BBC Radio Bristol:
"It's very frustrating. Credit to Birmingham. They've done a job on us. They dominated the game without the ball.
"First half, we played into their hands. We weren't compact enough in possession which left us loose and open to the counter.
"I tried to adjust that from afar but it was difficult and this is where the players need to recognise that."
Birmingham City manager Garry Monk told BBC WM 95.6:
"This whole season has been about having a small, tight squad. Everyone needs to be ready and has contributed but, at this stage, freshness is needed.
"There's a lot of minutes in those players' legs and the bumps and bruises are a little bit more so everyone needs to be ready and the lads showed that.
"The key point is the lads are together. Everyone is willing each other on. It doesn't matter who plays, everybody supports each other."
- 2PisanoBooked at 58mins
- 21PackBooked at 29mins
- 14WeimannSubstituted forPatersonat 64'minutes
- 45PalmerSubstituted forTaylorat 45'minutes
- 11O'DowdaSubstituted forEliassonat 45'minutes
- 9DiedhiouBooked at 46mins
- 5ColinBooked at 90mins
- 18MrabtiSubstituted forJotaat 71'minutesBooked at 85mins
- 7MahoneySubstituted forMaghomaat 64'minutes
- 9AdamsSubstituted forVassellat 81'minutes
- Geoff Eltringham
- Shots on Target
Second Half ends, Bristol City 1, Birmingham City 2.
Attempt missed. Eros Pisano (Bristol City) header from the centre of the box misses to the left. Assisted by Jay Dasilva following a set piece situation.
Maxime Colin (Birmingham City) is shown the yellow card.
Marlon Pack (Bristol City) wins a free kick on the left wing.
Foul by Gary Gardner (Birmingham City).
Foul by Eros Pisano (Bristol City).
Harlee Dean (Birmingham City) wins a free kick in the defensive half.
Corner, Bristol City. Conceded by Isaac Vassell.
Attempt blocked. Adam Webster (Bristol City) header from the centre of the box is blocked. Assisted by Jamie Paterson with a cross.
Corner, Bristol City. Conceded by Kristian Pedersen.
Foul by Tomas Kalas (Bristol City).
Kristian Pedersen (Birmingham City) wins a free kick in the defensive half.
Offside, Birmingham City. Jacques Maghoma tries a through ball, but Lukas Jutkiewicz is caught offside.
Niclas Eliasson (Bristol City) wins a free kick on the right wing.
Foul by Kristian Pedersen (Birmingham City).
Attempt missed. Josh Brownhill (Bristol City) right footed shot from outside the box is close, but misses to the left. Assisted by Tomas Kalas with a headed pass.
Attempt missed. Eros Pisano (Bristol City) right footed shot from outside the box misses to the right.
Jota (Birmingham City) is shown the yellow card for a bad foul.
Adam Webster (Bristol City) wins a free kick in the defensive half.