Clayton Donaldson grabbed his third goal of the season and David Cotterill his second in two games to put Blues in control at the break.
Lee Gregory pulled one back but Wes Thomas struck late on as Lee Clark’s men ended a seven-match winless run and secured a first away success of the season.
Millwall’s bright start to the season has evaporated, however, and another defeat leaves them with just one point from a possible 15.
The Lions, stung by criticism from boss Ian Holloway following the “dire” weekend loss at Huddersfield, went straight on the attack and Scott McDonald fired wide inside the first 30 seconds.
Scott Malone then floated in a dangerous cross which on-loan Watford striker Mathais Ranegie nodded just the wrong side of the post.
McDonald squandered another chance when he slid in to meet Ranegie’s downward header but again was off target, and the hosts promptly fell behind to Birmingham’s first real chance in the 32nd minute.
Donaldson held the ball up well on the edge of the area and fed Cotterill down the right before ambling unmarked to the six-yard box and tapping the winger’s low cross into an empty net.
Eight minutes later Millwall gave away a free-kick 25 yards out and Cotterill’s swerving shot deceived Lions goalkeeper David Forde as it bounced into the net to double Birmingham’s lead.
Holloway threw on young striker Aiden O’Brien at the break and the move paid off nine minutes later when his header sent Gregory clear to lift the ball over Darren Randolph for his first Lions goal since signing from non-league Halifax in the summer.
Defender Mark Beevers had a gilt-edged chance to haul Millwall level on the hour when he met Shaun Williams’ free-kick with a free header six yards out, but he planted the ball straight at Randolph.
Ranegie then hit the roof of the net with a header, O’Brien’s shot was deflected wide and Randolph denied Williams with a fine reaction save as the Lions built up a head of steam during the final 20 minutes.
Beevers was by now playing up front in a five-man attack, but their chances of an equaliser disappeared along with Ricardo Fuller’s wayward shot which flew over.
Instead Birmingham survived the onslaught and wrapped up a much-needed win when substitute Thomas tucked in Cotterill’s cross six minutes from time.