The Argentine teenager rifled in an unstoppable curled effort in the 90th minute to spark pandemonium at Old Trafford, before substitute Fred set the seal on a remarkable last-gasp fightback.
West Ham had earlier led through Said Benrahma’s controversial strike, before the unfortunate Nayef Aguerd headed into his own net to restore parity for the Carabao Cup winners in Wednesday night’s eventful fifth-round tie.
United will face high-flying Fulham in the last eight as they bid for another trip to Wembley in the semis.
United made six changes to their lineup that started against Newcastle in the Carabao Cup final, with the likes of key players Marcus Rashford and Casemiro initially named on the bench amid a truly hectic fixture list.
In came Harry Maguire, Victor Lindelof, Tyrell Malacia, Marcel Sabitzer, Scott McTominay and Garnacho, with Luke Shaw and Jadon Sancho sidelined and Fred only fit enough for the bench.
West Ham, meanwhile, made four enforced changes from a crucial 4-0 rout of Nottingham Forest in a Premier League relegation six-pointer that helped ease more mounting pressure on manager David Moyes. Michail Antonio replaced the cup-tied Danny Ings, with Alphonse Areola, Emerson Palmieri and Pablo Fornals also recalled in place of injured trio Lukasz Fabianski, Vladimir Coufal and Jarrod Bowen - the latter only on the bench after a knock.
The first half at Old Trafford was very low-key affair, with Garnacho the bright spark for the sluggish and ponderous hosts and Sabitzer’s early strike met with a strong one-handed save from Areola.
Otherwise the best chance fell to Antonio, who was sent through on goal but delayed his shot and allowed David de Gea to close the space and make the necessary stop. Ings would surely have scored.
Despite a solid first half, there was a sense that West Ham’s best chance might have passed them by as Erik ten Hag sent for Casemiro at the interval and McTominay withdrawn.
Tomas Soucek and Wout Weghorst both had early second-half chances, before West Ham took the lead in the 54th minute in controversial circumstances.
United essentially stopped playing after they thought the ball had gone out for a throw-in on the far side, only for it to be worked into the box and Benrahma to pick out the top corner with a superb right-footed strike.
There was a lengthy VAR check, but the goal was ultimately allowed to stand despite United’s vocal protests.
West Ham could then have gone 2-0 up after Fornals’ cross/shot flashed past the post and Antonio was again foiled by De Gea, while Areola did well to keep out Casemiro’s stinging low effort before Rashford drilled wide.
West Ham were eventually pegged back when Aguerd rose and inadvertently headed a Fernandes corner past Areola, before Garnacho’s 90th-minute heroics put United in front ahead of Fred applying the finishing touch.