Kristian Pedersen scored in added time at the end of the first half, before Town substitute Harry Cornick struck immediately after coming off the bench with just under 25 minutes to go.
Lukas Jutkiewicz secured all three points for the Blues in the 82nd minute as he bundled the ball in at the back post, as the Hatters were again left fustrated after a positive showing.
The Hatters maintain their 18th position, whilst the hosts extended the point gap between the two sides to eight, though remain in 11th place.
Blues went close to taking the lead after just two minutes, but James Shea brilliantly denied Jutkiewicz from a few yards out, as he powerfully directed Jude Bellingham’s cross towards goal.
Birmingham were on top during the first ten minutes and had two more chances to show for it. First Dan Crowley went close with a low-drive from the edge of the box, before defender Maxime Colin forced Shea into tipping his effort over.
Town grew into the game after a period of home pressure as Pelly-Ruddock Mpanzu stung the gloves of Lee Camp from range as he dived full length to push the midfielder's 20-yarder behind for a corner.
But Shea was called into action once again just before the half-hour mark to deny Jutkiewicz – as he did in the opening exchanges – this time producing a flying save from a deflected shot to keep the score level.
Jutkiewicz finally thought he got the better of Shea after finding the back of the net in the 37th minute, but the 30-year-old was judged to be offside following his touch on Crowley’s cross.
However, Birmingham did take the lead on the stroke of half-time courtesy of left-back Pedersen.
Crowley and Colin combined with a neat one-two over Town’s defence, the latter then crossed the ball for Pedersen to head home unmarked.
The Blues put plenty of early pressure on in the second half but somehow didn’t double their advantage as Jutkiewicz missed an open goal.
His forward partner Mrabti managed to keep the ball in-play – much to the surprise of the Town defenders – but as the ball rolled to Jutkiewicz, he put his guilt-edge chance wide of the goal.
Substitute James Collins then had the Town’s best moment, but his well-struck effort from 20 yards was saved onto the post by Camp.
Coming on moments after, Cornick was not to be denied by the goalframe, as he equalised for the Hatters in the 67th minute.
Brown crucially won a 50-50 challenge in midfield and set Cornick bearing down on goal from the right-hand-side, before he emphatically smashed his effort off the bar and into the back of the net to score his fifth goal of the season.
The Hatters were in the ascendancy after equalising and came close to finding a second fifteen minutes from time. Brown’s high cross to the back post had Collins stretching and because of that, his effort went just wide of the goal.
Against the run of play after a good spell of pressure, Birmingham regained the lead in the 82nd minute as Lukas Jutkiewicz headed in. Fran Villalba’s corner was met by captain Harlee Dean, who headed across the box for Jutkiewicz to bundle into the back of the net.
Sonny Bradley had a header cleared off the line minutes after going 2-1 behind, and Izzy Brown was denied a wonderful solo goal by a last ditch block in added time at the end.
Despite Town’s efforts, they couldn’t find a second equaliser as attention now switches to Nottingham Forest at Kenilworth Road next Saturday.
BIRMINGHAM: Camp, Colin, Dean, Roberts, Pedersen, Crowley (Maghoma 87), Sunjic, Bellingham (Davis 87), Villalba, Mrabti (Gimenez 77), Jutkiewicz. Subs not used: Trueman, Harding, Clarke-Salter, Bailey
Goals: Pedersen, (45+3) Jutkiewicz (82)
Yellows: Roberts
TOWN: Shea, Bolton (Butterfield 87), Pearson, Cranie, Bradley, Potts, Tunnicliffe (Cornick 66), Mpanzu, Brown, McManaman (Collins 60), LuaLua. Subs not used: Shinnie, Sluga, Bree, Jones.
Goals: Cornick (67)
Yellows: LuaLua, Collins, Cranie
Referee: Dean Whitestone
Attendance: 21,799 (2,676 Town fans)