City were staring down the barrel of an upset at St Mary's on Tuesday night after Adam Lallana fired Saints ahead shortly after the interval.
But two goals in three minutes from old stagers Lee Bowyer and Lee Carsley - Birmingham's first from open play this season - ensured the Blues dodged a bullet.
"It helps confidence and creates good habits, winning in the cup," said McLeish.
"The performance I'm not entirely pleased with but I didn't expect it to be smooth - we made a lot of changes and rotated the squad.
"But we soldiered on. When we went behind I thought we were going out of the cup. But I felt we had goals in us.
"If we'd gone two behind Southampton would have seen it through. But we got a lot stronger.
"It was a classic Bowyer goal, and Carsley has played a captain's role and got the winner."
McLeish made seven changes to the side which drew with Stoke on Saturday, but injuries throughout the squad meant this was no weakened line-up and also meant he could only name five
Hong Kong billionaire Carson Yeung is apparently close to completing his takeover of the club, and his promise of £5million to spend before next week's transfer deadline could come in very handy on this showing - although McLeish is dubious the cash will arrive in time.
"I've heard that as well! I don't know if it's possible or feasible to do it before you take ownership, but I would gladly accept it," he added.
"The window is closing but we also know we have to balance it in some way because some players might find themselves squad players because of the new players coming in."
McLeish is close to one new addition, adding: "I'm working on Michel from Sporting Gijon, and we hope to have some news on that this week."
Lallana, who has been with Saints since he was 12 and witnessed at first-hand their slide from the top flight, via administration, to the foot of the third division, struck with a stunning curler in the 51st minute.
City finally dragged themselves level when Bowyer latched onto a fine ball from £7million full debutant Christian Benitez and clipped it past Kelvin Davis.
By the 80th minute it was game over, Carsley sidefooting the winner from Stuart Parnaby's low cross.
A promising evening for Saints ended in defeat, and was also overshadowed by a nasty knee injury to veteran right-back Graeme Murty.
"It's a bad injury, it looks like a long one," said manager Alan Pardew.
"It's a shame we lost the game because the players deserved better. The performance and the goal we scored were special.
"The ref wasn't happy with me and I wasn't happy with him, I thought we had two good penalties turned down. I thought we played the best football we've played all season."