Yoann Barbet came close to giving Brentford the breakthrough from a free kick in the first half, but his effort dipped inches over the top of the goal.
After the break, QPR came out fighting as Sylla hit the woodwork after Josh Scowen headed into the box, but Brentford also went on the attack as Ollie Watkins tried to make the most of Jordan Cousins's slip.
The Brentford man was unable to do so, though, as his shot nestled into the side-netting, but just two minutes later the Bees were celebrating a goal when Lasse Vibe's low strike made it through.
The visitors almost doubled their lead immediately when Barbet sent the ball forward for Nico Yennaris, whose first-time volley skied over the bar.
Vibe starred again for Brentford as he nabbed his second of the night by sending the ball home from a Romaine Sawyers cross, but QPR launched a late revival as Matt Smith headed into the back of the net from a corner.
The crucial goal came in the 94th minute when Luke Freeman poked the ball past the goalkeeper from close range, sending the home crowd into a frenzy.