They dominated most of match, had the best of the chances, but when they could not take them, were hit with a sucker-punch at the end.
This one will have hurt more, though, as it came in a crucial game against relegation rivals and ends their 'week of death' on a bad note.
Having missed a hatful of good chances, Harlee Dean's deflected header in the 88th minute gave Blues the points which almost certainly means they will stay up.
The Millers are not dead and buried in the race to avoid the drop, but back-to-back losses against Coventry and now Birmingham will sting.
They are four points behind Derby with two games in hand, but how much this week has taken out of them remains to be seen.
A hectic period that started nine days ago and has taken in games against Huddersfield, QPR, and the two midlands clubs was always going to be decisive to their season and the fact it ended with two defeats could be telling.
There is not much time to recover, though, as they are back in action against Middlesbrough on Wednesday night.
Paul Warne's side had played twice since Birmingham last took the field, so there was an obvious disparity in energy levels.
So they could have done with taking a number of chances that fell their way to go in front.
Angus MacDonald turned a set-piece that went through a sea of bodies just wide before Michael Smith missed the chance of the first half for the Millers.
From a quick counter-attack, Matt Crooks carried the ball up the field, allowing Clark Robertson to cut back to Smith, but the top scorer's first time effort went painfully the wrong side of the post.
More chances came after the break as Freddie Ladapo could not force home a loose ball from a corner, with television replays suggesting he was impeded, and then Lewis Wing saw his goalbound effort blocked when he really had to score.
With all those chances gone begging, Rotherham fans knew what was coming.
In the 88th minute Dean climbed highest from a deflected cross and his header deflected off the top of Michael Ihiekwe's head and went into the top corner.
Rotherham had nothing in the way of a response as they slip slowly towards another relegation.