Sheffield Wednesday matched their best showing in the FA Cup since 1997 after strikes from Morgan Fox and Sam Winnall settled an all-Championship tie at Loftus Road.
The first half was drifting towards an uneventful conclusion until Fox saw his effort squirm just beyond Joe Lumley for the 26-year-old's third goal of the season.
After the break wastefulness from the hosts was punished as Winnall capitalised on slack marking to sweep home before Nakhi Wells made it 2-1 to bring some cheer to the home fans on a cold night in W12.
Midway through the first half Jacob Murphy's curling effort was kept out by Lumley before QPR set off on a breakaway. Ilias Chair went speeding down the pitch before laying the ball inside to the onrushing Marc Pugh, who fired his shot wide of Cameron Dawson's right-hand post.
The teams looked set to head into the break all square before Wednesday scored a goal that can only be described as soft.
A quick throw-in by Sam Hutchinson, level with the 18-yard box, looped over Todd Kane's head and landed at the feet of Fox. The left-back seemed confused that he had so much time to compose himself before seeing his shot from six yards trickle under Lumley's desperate dive.
The second half was similarly short on chances, with Rangers fans getting increasingly frustrated with full debutant Jack Clarke, as the Tottenham loanee was dispossessed on several occasions after failing to deliver a cross.
Bright Osayi-Samuel came on in his place in the 66th minute and almost had an immediate impact with his pass finding Chair, who fired wide.
Jordan Hugill then had his first chance of the game, but scuffed a shot wide after a glorious delivery from Kane.
Osayi-Samuel kept getting involved, with his vibrancy and relentless running causing the Wednesday backline problems, but the hosts were lacking a cutting edge.
The game would probably have been done and dusted had the recently introduced Atdhe Nuhiu not fallen over and Lumley not miscontrolled to let the ball run away from him.
Pugh felt he was nudged over by Wednesday captain Tom Lees in the 88th minute, but Keith Stroud waved away the complaints.
Kadeem Harris went close before Garry Monk's men bagged the decisive goal, as Nuhiu swept the ball out wide to fellow substitute Adam Reach, whose pinpoint cross was finished emphatically by Winnall to spark jubilant scenes in front of the 3,024 travelling fans.
Wells then rounded Dawson to keep the game alive and Ebere Eze subsequently won a corner to ramp up the volume before Pugh's wayward effort ended hopes of a comeback.