Former Tottenham midfielder Adel Taarabt had fired the hosts into the lead on 22 minutes with his first Premier League goal, but Arsenal levelled through Theo Walcott.
Rangers, though, snatched what could prove a priceless victory when Samba Diakite crashed in midway through the second half, but remain in the bottom three after Bolton won at Wolves.
QPR captain Joey Barton had used his pre-match programme notes to call for the Rs fans to get behind him after being booed off the pitch while being substituted during the win over Liverpool 10 days ago.
However, the controversial midfielder received a mixed reception when his name was read out ahead of kick off.
Walcott made early progress down the right channel, forcing a corner which was eventually hacked clear.
Arsenal continued to press without stretching the home side.
On seven minutes, Clint Hill bundled Walcott over to concede a free-kick just right of centre, 25 yards out.
Robin van Persie struck a low, curled effort goalwards, which Paddy Kenny gathered at the second attempt, with Walcott looking to pounce on the loose ball.
Rangers were soon on the offensive, with Alex Song needing to make a couple of important blocks as Bobby Zamora threatened.
The home side continued to push Arsenal back, and Zamora sent a free header over from 10 yards after a deep free-kick into the area.
The hosts had the lead on 22 minutes.
Taarabt collected a pass from the halfway line, before turning Thomas Vermaelen on the edge of the penalty area and dispatching the ball into the bottom corner.
Moroccan Taarabt marked his first Premier League goal by donning a fez that he then threw into the crowd, but referee Mike Dean took a dim view of his actions and brandished a yellow card.
Arsenal needed to regroup, but had been in this situation more than once recently and recovered to secure victory.
QPR, however, remained full of energy, with Taarabt enjoying plenty of the ball.
Arsenal were level on 37 minutes with their first real chance.
Van Persie made space on the edge of the area and stabbed the ball to Walcott.
The England winger cracked a first-time effort off the base of the far post, and was quickest to the rebound, hooking in his seventh Premier League goal of the season.
Arsenal now passed the ball around with confidence, Aaron Ramsey dragging a low shot from 20 yards across goal and wide.
The visitors pressed again at the start of the second half, as Bacary Sagna floated over a deep cross from the right which fellow full-back Kieran Gibbs nodded just wide.
QPR were now finding it difficult to retain much possession, and then gave the ball away when looking to build a break.
On 57 minutes, Kenny punched away an angled free-kick from Van Persie.
The Dutchman was denied again by the QPR keeper after spinning off his marker and racing into the penalty area.
QPR went ahead for the second time on 66 minutes.
Vermaelen slipped again, allowing Jamie Mackie to skip into the penalty and pulled the ball back for Diakite to slam home.
Arsenal needed another response and on 69 minutes, Gervinho replaced Ramsey.
QPR soaked up plenty of pressure, but also looked dangerous on the break as Arsenal committed men forwards.
With 10 minutes left, Mikel Arteta was replaced by Alex Oxlade-Chamberlain and Marouane Chamakh came on for Gibbs.
Barton almost sealed it when his effort was tipped over by Wojciech Szczesny after another break by Mackie down the right.
The late Arsenal fightback never materialised as Rangers closed out four minutes of stoppage time to boost their hopes of staying up.