Blues took the lead in the 12th minute through Matt Green and, although they dominated the game, Leicester had to wait until the 78th minute before equalising with a fine strike by Jamie Vardy.
Andy King and David Nugent, from the penalty spot, added two more before outplayed Birmingham grabbed a last-minute consolation from Chris Burke.
Leicester suffered a pre-match blow when influential captain Wes Morgan was ruled out with a back injury.
Manager Nigel Pearson opted for a 4-3-3 formation and the Foxes were quick out of the blocks, with Jamie Vardy racing clear from a Ritchie De Laet pass, only for Darren Randolph to deny him with a brave save at his feet.
The Blues goalkeeper needed lengthy treatment before he could continue.
Pearson had asked the players to turn the King Power Stadium into a fortress, but their defence was breached in the 12th minute by Birmingham's first attack. Shane Ferguson crossed the ball from the left and, when Leicester failed to clear, Green pounced to drill home a shot from close range.
It was his first goal for Blues after joining them in the summer from Mansfield, for whom he scored 40 goals in 62 League games.
The goal was against the run of play and the Foxes continued to dominate the first half without being able to convert the chances they created.
Matty James ballooned a shot over the bar after a low cross from Jeff Schlupp and Danny Drinkwater was also high and wide with his effort following a long throw-in from Liam Moore.
The chances kept on coming - and kept on being wasted. Schlupp fired wide after cutting in from the left, Drinkwater shot over after some excellent work by Nugent and Vardy saw his effort scrambled away by Randolph at the near post.
And in first-half stoppage time King and Chris Wood both missed two more good opportunities.
Pearson brought on Anthony Knockaert and Lloyd Dyer for Drinkwater and Wood for the second half and switched to a 4-4-2 system.
However, the pattern remained the same with the Foxes totally dominant without breaking through. Knockaert put a shot into the side net from Dyer's low centre and Nugent wasted another chance in the 57th minute with his side-foot shot saved by Randolph.
Foxes goalkeeper Kasper Schmeichel was brought into the action diving to tip a free-kick from Neal Eardley round the post in the 66th minute.
But in the 78th minute the equaliser finally arrived, with Vardy driving a low right-foot shot into the net from the edge of the penalty area after a great run down the left by Dyer.
Four minutes later the Foxes were celebrating again with King producing a clinical finish from Nugent's pass, and a penalty by Nugent in stoppage time after Eardley had brought down Dyer increased Leicester's lead.
Blues hit back with a last-ditch goal from substitute Burke but the Foxes held on for their first home win of the season.