Rangers had won only twice in 18 games heading into Saturday's contest against the team sat in third in the league table, but first Premier League goals for Adel Taarabt and Samba Diakite gave them victory in the London derby.
Theo Walcott had drawn Arsenal level after 37 minutes, and Robin van Persie wasted a superb chance to put Arsenal in front early in the second half, but Arsene Wenger's side were guilty of a poor performance as they passed up the chance to open up a six-point lead over rivals Tottenham, who play Swansea on Sunday.
Though Rangers remain in the bottom three due to Bolton's victory at Wolves, the performance and result, ensuring back-to-back home wins following a 3-2 victory over Liverpool, will give them renewed hope of avoiding relegation.
QPR were the better side from the off as their combative midfield and tireless forwards hassled the visitors from North London at every opportunity. The home side were also a persistent threat from set-pieces, with Bobby Zamora heading over when well placed to meet a Taarabt free kick after 14 minutes.
Arsenal threatened from a set-piece of their own when Van Persie went under the wall and drilled in a low effort that Paddy Kenny saved at the second attempt, but the Champions League hopefuls looked strangely listless in the opening exchanges.
They were duly punished for the slack nature of their performance on 22 minutes when Taarabt scored his first Premier League goal. The forward received a pass from Diakite and did well to spin away from the over-committed Thomas Vermaelen before caressing a finish past Wojciech Szczesny from the edge of the box.
The Morocco international produced a fez by way of celebration - which had presumably been lurking in his shorts for the entirety of the season, awaiting that previously elusive goal - and was booked by referee Mike Dean for his troubles.
Consolation could be found for Arsenal in the fact that they had won more points from losing positions than any other team in the league, while QPR had dropped the most points from winning positions.
It was little surprise, then, when Arsenal drew level on 37 minutes. Van Persie did excellently to drive into the box and play Walcott in with a cute short pass, and after striking the base of the post the winger reacted quicker than a stationary QPR defence to volley the rebound home with his instep.
Aaron Ramsey then dragged a shot just wide of the far post as Arsenal took heart from their equaliser and finished the first half as the better side.
The trend continued at the start of the second half as Kieran Gibbs headed just wide when meeting a deep cross from Bacary Sagna at the far post. Meanwhile, Van Persie was only denied a 27th league goal of the season by a superb save from Kenny after he found himself one-on-one after collecting a Song pass and spinning away from Clint Hill.
However, QPR responded magnificently in a tireless performance and, after Taarabt had tested Szczesny with a fierce effort from 35 yards that swerved in the air, the home side edged back in front after 66 minutes.
Vermaelen was culpable as he slipped on the edge of the box, allowing Jamie Mackie to snatch possession and dart into the box himself. The forward found a curiously unmarked Diakite with his cut-back and the Malian midfielder finished emphatically with his right boot when sweeping the ball past Szczesny.
Arsenal threw on Alex Oxlade-Chamberlain and Marouane Chamakh in an attempt to get back into the game but it was QPR who looked the more likely to score, even in the closing stages, with Barton forcing Szczesny into a fine save with his first-time shot from Mackie's cut-back.
The assistant referee was struck by a coin throw from an area of home supporters in injury time, ensuring the Football Association is likely to further examine the incident, but Mark Hughes and his players can only draw positives from a fine performance and victory.