Marouane Fellaini volleyed the visitors in front on the hour before James Wilson secured the victory in stoppage time, firing home the rebound from his own low effort.
Rob Green produced a superb double save to deny Radamel Falcao, while the hosts had chances of their own as Charlie Austin was twice denied by United goalkeeper David De Gea.
Falcao then missed a simple tap-in at the far post before bringing out another excellent stop from Green, but the visitors took the victory – their first in four Premier League outings – to keep Harry Redknapp’s side in the bottom three.
Bobby Zamora was given the nod up front with Austin by Harry Redknapp as Adel Taarabt dropped to the bench, while Falcao led the line for the visitors in place of Robin van Persie, who failed to shake off an ankle problem picked up in the defeat to Southampton.
United looked nervous in the early stages, especially in possession as they failed to cause QPR that many problems inside their own half.
Van Gaal’s men had the first big chance of the game, though, as Juan Mata fired a superb ball beyond the defence before Falcao drew an excellent double save from Green, drilling a volley at the goalkeeper and then seeing his rebound kept out.
At the other end Austin was the unsurprising source of their best efforts, seeing a blasted shot turned away by De Gea before he unleashed a stunning 25-yard dipping volley, only to be denied by a wonderful diving stop from the United shot-stopper.
Van Gaal changed things at the break as he withdrew Mata in favour of Fellaini while Wilson replaced Jonny Evans, and the visitors looked far stronger in a changed system.
Falcao saw another effort saved, Green producing another excellent stop to divert his free header wide after the Colombian latched on to a wonderful cross from Di Maria.
But the deadlock was finally broken just before the hour, Rooney finding Valencia beyond the full-back and the winger fired it low into the box for Fellaini, who hammered a volley which Green could only help into the net.
United then should have made it 2-0 as Falcao spurned another chance after superb work from Wilson. The youngster got in behind and squared to the Colombian at the far post, who couldn’t connect with the ball after a slight touch from Steven Caulker.
But the killer blow came in stoppage time, with QPR pressing hard for an equaliser. The visitors broke up the other end and Wilson saw his low effort superbly saved by Green, but the youngster got to the rebound first and fired it into the corner to secure United’s victory.
Manchester United: De Gea (8), Jones (6), Evans (6), Rojo (8), Carrick (7), Valencia (6), Di Maria (5), Mata (5), Blind (6), Rooney (6), Falcao (6).
Used subs: Herrera (6), Fellaini (8), Wilson (8).
QPR: Green (8), Isla (7), Onuoha (7), Dunne (7), Hill (6), Vargas (6), Barton (6), Henry (7), Fer (6), Austin (7), Zamora (7).
Used subs: Caulker (7), Kranjcar (6), Taarabt (6).
Man of the match: Marcos Rojo