Leonard had two spells on loan to Northampton Town before joining City 18 months ago.
His most recent appearance was on New Years Day, when he came off the bench in their 3-0 away defeat by Watford.
Half of his 64 appearances overall have been off the bench as the Scot has found it more difficult to secure a starting place after promotion to the Championship, where Birmingham lie 13th.
Hearts are without the suspended Beni Baningime for Sunday’s crucial Scottish Premiership match, with fellow midfielder Cammy Devlin out for up to two months with a lower leg injury.
Leonard’s arrival strengthens Hearts’ midfield options and comes after Forest Green Rovers manager Robbie Savage confirmed his club had rejected a bid for Laurent Mendy from the Tynecastle outfit.
“Every minute I’ve worked with him, he’s brilliant and that’s why Hearts made an offer, but it didn’t meet the club’s valuation,” Savage told club media.
“I think now Hearts have moved on. I’m sure the lure of Hearts – top of the Scottish Premiership – must have been a real attractive pull for a player who’s 29.
“I’m not naive enough to think a player in his situation won’t be tempted by that. I can’t speak for Mendy, but a team like Hearts with the possibility of winning the league and getting into the Champions League, it would have been an unbelievable opportunity for an unbelievable player.
“Inevitably, if a valuation is not met, the club will decide what happens.”
