A spectacular strike from Sebastian Coates and a second from Dirk Kuyt gave Liverpool a two-goal cushion, but Mark Hughes’s side drew level courtesy of late goals from Shaun Derry and Djibril Cisse.
A remarkable comeback was complete as substitute Jamie Mackie scored a third in the final minute of stoppage-time, and the hosts were left delirious as Liverpool saw a dominant position slip through their grasp in dramatic fashion.
Luis Suarez and Martin Kelly both recovered from knocks to start for Liverpool as Kenny Dalglish made two changes to the side that beat Stoke at the weekend, bringing in Charlie Adam and Kuyt for his 200th Premier League appearance. QPR also made two changes with Luke Young and Adel Taarabt replacing Clint Hill and Shaun Wright-Phillips.
Suarez should have put the visitors in front as early as the fifth minute as he surged through on goal after receiving a pass from Charlie Adam, but could only plant a tame shot on target with Paddy Kenny afforded a comfortable save.
What ensued was a barrage of pressure from the Reds as QPR were repeatedly carved open at the back, and Liverpool dominated possession without managing to make their pressure count.
Stewart Downing forced his way beyond the exposed QPR back four once more as Martin Kelly provided a precise pass, but Derry produced an impeccable last-ditch challenge to prevent a close-range shot.
The hosts were restricted to fleeting forays into the final third, but Cisse unleashed a ferocious drive from 25 yards out with Pepe Reina comprehensively beaten as the ball fizzed agonisingly wide of the far post in the 33rd minute.
Dalglish made an early enforced change as Kelly had to be replaced by Coates, and Adam hobbled off on the stroke of half-time after twisting his left knee following a challenge from Armand Traore, who also went off injured.
A match which lacked quality in the final third suddenly changed as substitute Coates struck an inspired and quite brilliant scissor-kick volley from inside the QPR box as the ball flew past Kenny in emphatic fashion to break the deadlock.
The reaction was one of fury from much of the home crowd, and Joey Barton copped the brunt of the anger as two misplaced passes were met with jeers and boos. Hughes acted quickly by hauling off Barton with Mackie introduced, and a mixture of boos and cheers met the decision as the midfielder polarised opinion amongst the fans.
The match looked beyond the hosts as Liverpool doubled their lead in the 72nd minute: Suarez struck the far post with a low drive, before Kenny pulled off a fine save to deny Downing, but Kuyt was on hand to turn the ball home from close range to mark his 200th league appearance for the Reds with a goal.
Liverpool’s two-goal cushion did not last long, however: Jordan Henderson was the culprit of slack marking as Derry rose high at a corner kick to head home powerfully from inside the penalty area to drag his side back into the clash in the 77th minute.
The Reds suddenly looked incredibly anxious and QPR piled on the pressure with Cisse scoring against his former club with an imperious header from a Taye Taiwo cross four minutes from time to restore parity.
But more was to come from the ecstatic hosts as Young headed the ball forward, and inexplicably the Liverpool defenders parted to leave substitute Mackie with a free run at goal, and he drove the ball clinically past Reina to give his side all three points.
It was only QPR’s second victory in their last 17 Premier League matches, while Liverpool have still only recorded a miserly two league wins in 2012 as Dalglish’s side failed to close the gap on sixth-placed Newcastle.