Deon Burton kept Sheffield Wednesday's Championship survival hopes alive by converting a second-half penalty to complete an impressive turnaround against QPR.
Damien Delaney had given Rangers a 15th-minute lead at Hillsborough - but Graham Kavanagh's goal on the stroke of half-time clawed the Owls back into a game they desperately needed to win.
Burton's winner seven minutes after the restart proved enough to see off Rangers, who had substitute Hogan Ephraim dismissed in the dying minutes for a reckless challenge.
The Owls started the day four points adrift of safety in 22nd place, albeit with a game in hand on their closest rivals.
Rangers have eased their relegation worries in recent weeks and even dared to dream of a late push for the play-offs.
Portsmouth winger Franck Songo'o went straight into Brian Laws' starting XI after completing his loan move from Fratton Park - while QPR brought back Dexter Blackstock to play alongside Patrick Agyemang and Rowan Vine in attack.
But it was the Owls who started the brighter, and Enoch Showunmi made his intentions clear in the fourth minute with an ambitious 25-yard drive which fizzed past the post.
At the other end, Vine was beginning to impose himself on proceedings - and it was his cross that led to the breakthrough.
After some good work down the left, Vine delivered an inviting ball into the penalty area which was met by Delaney - who side-footed neatly into the bottom right-hand corner.
It was Delaney's first goal for Rangers and his first since December 2006 in competitive football.
Rangers were looking comfortable and came very close to doubling their advantage in the 25th minute.
Agyemang drilled a right-footed effort against the foot of the post to spare Wednesday a daunting two-goal deficit.
Wednesday were unable to offer much in the way of attacking ideas and found themselves stifled by the strength of Damion Stewart and Delaney at the back.
Laws replaced Showunmi with Burton, and youngster Sean McAllister came on for Ronnie Wallwork.
Within moments of the substitutions, Wednesday were level.
Songo'o did the leg work down the right flank before squaring for Kavanagh, who drilled emphatically into the top left corner.
Wednesday were let off the hook moments after the restart when another cross from Vine found Blackstock, but the striker was unable to hit the target from close range.
Rangers were made to pay for their profligacy in the 51st minute when the Owls took the lead.
Substitute McAllister went surging into the box only to be brought down by the onrushing Lee Camp, leaving referee Neil Swarbrick no option but to point to the spot.
Burton stepped up to smash the penalty into the bottom right corner.
Rangers replaced Vine with Ephraim and Mikele Leigertwood with Gavin Mahon in an attempt to freshen up their options, and came close again in the 66th minute.
Blackstock met Delaney's cross with his head, only to be denied by a fantastic save from Wednesday goalkeeper Lee Grant.
The hosts were denied only by a brilliant stop by Camp, who somehow managed to tip Kavanagh's long-range effort around the post with 18 minutes remaining.
The game ended on ugly terms with Ephraim dismissed for a frustrated challenge on Songo'o, just seconds before the final whistle.
Teams:
Sheff Wed Grant, Hinds, Beevers, Wood, Spurr, Kavanagh, Small (O'Brien 90), Wallwork (McAllister 40), Songo'o, Tudgay, Showunmi (Burton 40).
Subs Not Used: Burch, Boden.
Booked: Tudgay.
Goals: Kavanagh 45, Burton 52 pen.
QPR Camp, Delaney, Stewart, Mancienne, Connolly, Rowlands, Leigertwood (Mahon 66), Buzsaky (Balanta 75), Blackstock, Agyemang, Vine (Ephraim 63).
Subs Not Used: Pickens, Rehman.
Sent Off: Ephraim (90).
Booked: Stewart, Delaney.
Goals: Delaney 15.
Att: 18,555
Ref: Neil Swarbrick (Lancashire).