Birmingham, teetering on the edge of relegation for much of the season, clawed a step closer to safety following this crucial home success.
It was a pulsating Birmingham performance as they pressurised United for long periods but they had to show a lot of courage to fight back after a sixth-minute goal from former Birmingham player Mark Duffy.
It was Marc Roberts, drafted into the side in place of suspended captain Harlee Dean, who sparked off Birmingham's recovery with a 31st-minute strike for his first goal of the season with Maghoma clinching the vital points with a fine individual effort after 69 minutes.
United, without a win in their previous four games, made a positive start in their bid to get back into the play-offs as two former Birmingham players cashed in on some poor defensive play. Clayton Donaldson clashed in midfield with Michael Morrison and the ball went back into United's half, where John Fleck produced a slick pass to the livewire Duffy.
The stocky striker, who had an outstanding game for the Blades, took full advantage of the open space to move forward and open the scoring with a low near-post shot which completely deceived goalkeeper David Stockdale. He then collected a yellow card for over-celebrating the goal against his old club.
With the atmosphere electric, Stockdale was better prepared a few minutes later when he pushed a stunning drive from Lee Evans over the bar.
It was a feisty game with neither side holding back as they battled hard for the points and Birmingham's sheer determination saw them rewarded with an equaliser from Roberts, who was on hand at close range to convert a left-wing corner from Maghoma.
A minute into the second half Jamal Blackman had to make a low save to keep out a Lukas Jutkiewicz header from Jota's cross.
But Blackman had no chance when Maghoma raced clear after picking up a lofted pass form Che Adams to score with a shot on the run in the 69th minute and take them five points clear of the bottom three.
Kylian Mbappe has ruled out a move to Real Madrid and insists he will be staying with Paris Saint-Germain next season.
Tottenham are reported to be leading the race for Barcelona midfielder Andre Gomes but face competition from Arsenal.
Wolves are keen on Manchester City starlet Oleksandr Zinchenko but will face strong competition for his services.
Didier Deschamps praised France's performance after his side beat Croatia 4-2 in Sunday's World Cup final at the Luzhniki Stadium.