Relegated Rangers looked on course for just their fifth win of the campaign when Loic Remy's penalty put them ahead but Hatem Ben Arfa replied with another spot-kick before a defensive mix-up allowed Yoan Gouffran to net the winner, although the Magpies were forced to hang on after goalkeeper Rob Elliot's late red card.
Bobby Zamora blazed a free-kick over the bar for Rangers during a scrappy start, but the deadlock was broken by the hosts in controversial fashion when Remy netted from the spot in the 11th minute.
Remy struck after Mathieu Debuchy was penalised for pulling Junior Hoilett's shirt, although there were strong protests from Newcastle that the offence had occurred outside the area.
Referee Lee Probert was pointing to the spot again seven minutes later after Rangers full-back Jose Bosingwa had returned the favour by tugging the shirt of Ben Arfa, who spectacularly blasted home the penalty to level.
Probert took centre stage once more in the 22nd minute after he disallowed Papiss Cisse's goal from Debuchy's cross, the striker only a matter of inches offside.
Elliot then foiled Hoilett before the visitors took the lead in comical fashion in the 35th minute through Gouffran.
Bosingwa's back-pass to Rob Green was closed down by Jonas Gutierrez and the goalkeeper's rushed clearance fell to Gouffran who side-footed into an empty net from 25 yards.
The start of the second half lacked intensity as both defences tightened up, but QPR enjoyed a bright spell just after the hour as an alert Elliot intercepted Andros Townsend's centre to Zamora before Hoilett dragged a shot wide.
More slack Rangers defending presented Newcastle with another chance from an indirect free-kick after Armand Traore needlessly passed back to Green, but Hoilett was able to block Ben Arfa's effort.
Gouffran's cross then almost found the net after good work by Ben Arfa but the game took a dramatic twist with nine minutes remaining when Elliot was sent off for a second bookable offence after handling outside his area.
Steve Harper made a rare appearance from the bench as Ben Arfa was sacrificed by Alan Pardew and the 10 men held firm during a nervy finale, Townsend going closest for Rangers with a long-range effort that flashed just over the crossbar.