Jamie Mackie scored a dramatic injury-time winner to move QPR out of the relegation zone with a highly fortuitous win over Liverpool at Loftus Road.
The Reds laid siege to the home goal in the first half but could not find a way through until nine minutes after the break when Sebastian Coates opened his Liverpool account with a brilliant scissor-kick.
Dirk Kuyt made it 2-0 soon after with a close-range tap-in and the home fans made clear their disappointment when they booed off captain Joey Barton in the second half.
QPR were in danger of going 3-0 down after some more poor defending but Shaun Derry gave the hosts a glimmer of hope with a 77th minute header.
Djibril Cisse then stepped up to head home his third goal in four games with just four minutes left to give the home side an equaliser.
And the home crowd then erupted into ecstasy in the 91st minute when substitute Mackie slotted home through Jose Reina's legs to give QPR a win they never looked like achieving.
QPR were a shambles early on as Samba Diakite and Barton both misplaced passes leading to Liverpool attacks.
Barton chose to quote Rudyard Kipling in his programme notes, reminding his team-mates of the importance of keeping their heads in the heat of a relegation battle.
His message failed to have an impact however, and the Rangers skipper was the first player to lose concentration, laying a pass straight into the path of Charlie Adam, who released Luis Suarez with a long pass down the middle.
The Uruguayan skipped past Nedum Onuoha, but could only muster a weak shot at Paddy Kenny.
Martin Skrtel had a shot blocked in the area as the ball pinged around the box in the fourth minute and Anton Ferdinand did well to block Kuyt's effort.
Stewart Downing raced clear but was blocked just in the nick of time by Shaun Derry.
Again Liverpool came forward, this time through Steven Gerrard, who exchanged passes with Suarez before driving a low ball across the box which just evaded Kuyt.
QPR almost took a shock lead in the 29th minute when Jose Enrique unwittingly volleyed just over his own crossbar.
Martin Kelly, who suffered a shin injury against Stoke last weekend, hobbled off after 34 minutes to be replaced by Coates.
Rangers improved towards the end of the first half, with Cisse firing a low drive that nestled into Reina's side-netting.
Armand Traore scampered across from left-back to put in a crucial sliding tackle on Adam. Both players needed treatment and did not reappear after the break, with Taye Taiwo coming on for QPR and Jordan Henderson for Liverpool.
Liverpool continued to lay siege to the Rangers goal and they got their reward with Coates' stunning opener.
Bobby Zamora cleared off the line from Downing's strike, but the ball flew straight up in the air to the Uruguayan centre-back who let fly with an athletic kick which beat Kenny from 12 yards.
Downing stung Kenny's palms with a powerful drive moments later as Liverpool looked for a second.
Barton's night ended in the 62nd minute when he came off for Mackie amid boos from the home fans, who were clearly unhappy with their captain's efforts.
Kenny put in a fantastic save to keep the score at 0-1 but the R's stopper was beaten moments later by Kuyt.
Suarez's brilliant drive rebounded off the post to Downing, who waltzed closer to goal before firing a fierce drive that Kenny did well to save, but the rebound fell to Kuyt who tapped in.
The unlikely comeback began in the 77th minute, however, when Derry rose to head home Adel Taarabt's corner.
Suarez, who had been booed all night, came off with eight minutes to go for Andy Carroll.
Gerrard clipped a curling free-kick just over the bar as Liverpool looked to kill off the game.
But there then followed five barmy minutes which ended with QPR grabbing the win that puts them two points clear of danger.
Cisse headed home Taiwo's cross in the 86th minute before Mackie raced onto Luke Young's flick before calmly slotting past Reina deep into added time.