Bobby De Cordova-Reid nodded Leicester into a 42nd-minute lead at Old Trafford, but Joshua Zirkzee levelled the scores in the 68th minute, before Maguire headed a Bruno Fernandes free kick into the back of the net in the 93rd minute to win it for Ruben Amorim's side.
Man United have advanced into the fifth round of the FA Cup - the competition that they won last season - and it was a huge result for Amorim considering the pressure that the Portuguese is currently under.
Ruud van Nistelrooy received a warm welcome from the Man United fans on his return to the club, but the Dutchman saw his Leicester outfit bow out of the competition in dramatic fashion at Old Trafford.
SPORTS MOLE'S VERDICT
Oh how Amorim needed this.
Leicester dominated the first period, and a defeat to the Foxes would have been incredibly damaging for Amorim, with the tension inside the stadium making it difficult for Man United to perform.
Alejandro Garnacho changed the match, though, with the Argentina international finally providing Man United with a threat in the second period, and it is incredible to think that he could have been sold during the January transfer window.
Amorim's 3-4-3 formation again looked untidy, and debutant Patrick Dorgu surprisingly featured down the right before being replaced after an encouraging first period, but Man United managed to get the job done.
The cup competitions are so important for the 20-time English champions this season, as European football for next term is not going to be secured through the Premier League, and the Red Devils are now through to the fifth round of the FA Cup, with Maguire coming up trumps against his former club in Fergie Time.
MAN UNITED VS. LEICESTER HIGHLIGHTS
Bobby De Cordova-Reid goal vs. Man United (42nd min, Man United 0-1 Leicester)
Leicester take the lead in the 42nd minute of the contest, as De Cordova-Reid heads into the back of the net from close range after Andre Onana had kept out a low strike from Wilfred Ndidi; Man United again fall behind at Old Trafford.
Joshua Zirkzee goal vs. Man United (68th min, Man United 1-1 Leicester)
Man United level the scores in the 68th minute of the contest, and the goal comes from Zirkzee, who taps into an empty net after Rasmus Hojlund's flick from a Garnacho cross had been deflected into his path.
Harry Maguire goal vs. Man United (93rd min, Man United 2-1 Leicester)
Maguire heads a Fernandes free kick into the back of the net to surely win it for Man United! Maguire looked clearly offside, but there is no VAR at this stage of the FA Cup, and the Red Devils have netted a late second.
MAN OF THE MATCH - ALEJANDRO GARNACHO
Garnacho changed the game for Man United at the interval, with the Argentine suddenly giving the Red Devils a threat, and it was his excellent work that led to the home side levelling the scores.
Leicester right-back James Justin found it incredibly difficult to deal with the forward when he had possession of the ball, and there is no question that he was a key contributor to the home side securing a spot in the next round.
MAN UNITED VS. LEICESTER MATCH STATS
Possession: Man United 55%-45% Leicester
Shots: Man United 13-6 Leicester
Shots on target: Man United 4-3 Leicester
Corners: Man United 6-1 Leicester
Fouls: Man United 10-11 Leicester
BEST STATS
WHAT NEXT?
Man United's attention will now switch back to the Premier League, with the Red Devils continuing their league campaign with a contest against Tottenham Hotspur next Sunday, while Leicester will host title-challenging Arsenal next Saturday in England's top flight.
The Foxes are currently 18th in the Premier League table, two points behind 17th-placed Wolverhampton Wanderers, while Man United sit 13th in the division, some 11 points behind fifth-placed Manchester City.
Written by
Matt Law