Romaine Sawyers grabbed his first Brentford goal to help secure victory and lift them to within a point of the play-offs.
Josh Clarke had fired the Bees ahead just before half-time and Sawyers, a free northern summer signing from Walsall, opened his account with a second-half cracker to end their 52-year wait for a win at Loftus Road.
The fact this was only the sixth time Brentford have made the short trip to QPR in that period did not stop their fans revelling in a rare success over their historically more illustrious neighbours.
QPR, by contrast, left the field to boos from the home supporters who had bothered to stay until the end.
Victory was no more than the Bees deserved after they created a host of chances - although their eight-goal striker Scott Hogan was uncharacteristically wasteful.