The Lilywhites won their third game in a row at Deepdale but only after Kazenga Lualua's 36th minute goal had given the London side the lead.
Aiden McGeady curled home a superb equaliser just before the break, with Jordan Hugill netting the winner in the second half.
QPR went down to 10 men in the 78th minute when Luke Freeman's challenge on Tommy Spurr earned him a red card for his second booking of the game.
North End boss Grayson said: "When you play against Ian Holloway's teams you have to be at it, they ask questions of you and will change system - you have to do whatever you can as a group to win the game.
"In the first half we were a bit disjointed but in the second half we were very good.
"It was a disappointing goal to give away in the first half, it was a throw-in into the box and unfortunately it went through Tommy Spurr's legs.
"To be fair to their lad, he showed great awareness and skill to put it in the net.
"We responded well and when you have someone like McGeady who can do something out of nothing, it is a big bonus.
"He showed the quality he has got to get the space in the first place, then manoeuvre the ball into the right area and then put it into the net.
"To see it fly into the far corner was just what we needed before half-time."
Grayson put North End's first-half struggles down to a different formation, with him picking a 3-4-3 on the basis that he without a recognised right-back because Tyias Browning was out injured and will be sidelined for six weeks.
"In the first half we were a little bit disjointed and I will take responsibility for that," said Grayson.
"We played a system which we had not played too much this season, we tried to play a 3-4-3.
"We didn't have a right-back available at the club and I thought a 3-4-3 might suit us with McGeady, Hugill and Callum Robinson up there, with the wing-backs Daryl Horgan and Greg Cunningham pushing on.
"We hadn't had a lot of time to work on it to be honest.
"Until half-time we hung in there and then we decided to go back to the 4-4-2 and we looked a massive threat.
"Greg Cunningham went to right-back and he has been exceptional since he has been at this club.
"On Friday I had half contemplated playing him at right-back and Greg said he would give it his best.
"He played there in the second half and looked good.
"For the second goal, Jordan did well in the first place to lose his man and have the first shot.
"Alex Smithies made a real good save and Jordan was first to react.
"It gave us something to build off, the sending-off then happened and the game opened up.
"Some of the play in the second half was exceptional with the only thing missing being the ruthlessness to get a third or fourth goal to make it really comfortable.
"I'm really pleased to get the three points from a hard-fought win."