French midfielder Diakite hit the winner in the 66th minute after being set up by Jamie Mackie.
Adel Taarabt had given QPR the lead in the 22nd with a curling finish inside the left hand post for his first goal in the Premier League.
Theo Walcott equalized for Arsenal in the 37th after his initial shot had hit the post.
QPR remained in the relegation zone on goal difference behind Blackburn, which hosts Manchester United on Monday.
Third-place Arsenal's loss means Tottenham can move level on points with its north London rival with a win over Swansea on Sunday.
QPR overturned a two goal deficit to beat Liverpool 3-2 in its previous game at Loftus Road and showed similar resilience against Arsenal, which came into the match with seven straight league wins. The hosts had a chance to go ahead with 15 minutes gone when Bobby Zamora connected well with a curling free kick from Taarabt but his header went just over the bar.
Taarabt got the first goal of the match with a shot to the bottom left-hand corner after some neat footwork enabled the Moroccan to break free from Thomas Vermaelen.
Arsenal equalized when Rosicky found space in an otherwise congested midfield and passed to Robin van Persie. The Dutchman's clever footwork allowed Walcott to smash the ball into the net after his initial effort rebounded kindly off the post.
Arsenal came close to taking the lead in the 59th when Van Persie escaped QPR's offside trap. But the Premier League's top scorer shot straight into the arms of goalkeeper Paddy Kenny.
With just over an hour gone, Scottish forward Jamie Mackie latched onto a loose ball and powered past Vermaelen before passing to Diakite who blasted the ball into the net.
"I felt that if you had the choice you want a better pitch but I don't think it explains why we were beaten in too many domains," Arsenal manager Arsene Wenger said.