QPR boss Marti Cifuentes dedicated the much-needed victory over Stoke to the memory of Terry Venables.
Rangers won 4-2 against the 10-man Potters, who had Enda Stevens sent off early in the second half.
It clinched a first win in 13 matches and only their second at home since October last year.
Venables, who died last week, was a popular player at Loftus Road and as manager guided Rangers to an FA Cup final, promotion to the top flight and then a fifth-placed finish which saw the club qualify for Europe.
“It was a roller coaster of a game and a fantastic win for us,” said Cifuentes.
“I’m really happy, first of all for the players and for the supporters and because I really wanted to win this game in memory of Terry Venables.
“The players know all about a legend like him and the impact he had not only at QPR but in English football and at Barcelona.
“We mentioned that we wanted to go that extra mile to make sure we won the three points for his memory.”
After Lyndon Dykes put the hosts ahead, Ryan Mmaee brought Stoke level just before half-time.
Shortly after Stevens’ dismissal, Wouter Burger put the Potters ahead before Dykes netted his second of the night.
Ben Pearson’s own goal was the stroke of luck struggling Rangers needed, and Chris Willock added a fourth in stoppage time.
Cifuentes said: “Conceding a goal before half-time is always a bit tougher.
“I told the guys it was a great challenge for us to show what kind of team we want to be; a losing team with sad faces and complaining or a team with ambition who chases victory.
“We did that even after they scored their second goal when they had 10 men. Emotionally, that was a big challenge and I’m so glad for them.”
Stoke boss Alex Neil was critical of referee James Linington’s performance.
“I thought there were two horrific decisions that changed the complexion of the game,” Neil said.
“It was as soft a penalty as you’re likely to get. The sending-off is also really soft. I thought both decisions were really poor.
“The problem you’ve got is that you’ve got some referees that want to make themselves the centrepiece of the game rather than letting the game take place and just managing it.
“I said to him that I thought he changed the complexion of the game and that’s not the job of a referee.
“What I said to the fourth official during the game was ‘I’m not looking for any handouts or favours. I’m just looking for fair decisions’.
“The amount of bookings dished out in this game was incredible for a game in which I don’t think there was a bad tackle.
“I don’t think it was a nasty game by any means. We got eight bookings, which is just absolutely ridiculous for a game where there wasn’t a bad tackle.
“Let’s be honest, if both teams had 11 on the pitch then I think we’re the better side.
“We took the lead and I thought we were going to go on and win the game quite comfortably.”