After the full-time whistle, Boro coach Aitor Karanka and his QPR counterpart Jimmy Floyd Hasselbaink had a heated discussion at the side of the pitch, a product perhaps of the late drama at Loftus Road as Chery reduced the arrears with five minutes of normal time remaining after Sebastian Polter had an earlier effort ruled out for the hosts.

Victory for Boro – edging the Teessiders above Brighton in the table before the Seagulls’ match against leaders Burnley on Saturday – ends a miserable run of three successive defeats on the road.

QPR’s first loss in four games leaves them 11th in the table.

Boro started brightly and Rhodes did enough to put the visitors ahead, beating Smithies with a scuffed finish to trickle the ball over the line after pouncing on a misjudged header from Grant Hall.

Mackie then punished Boro for failing to clear a free-kick into the box, showing great skill to swivel on the edge of the area and cannon the ball off the underside of the bar and over the line.

Smithies made a fine one-handed save to keep Leadbitter out after Alejandro Faurlin brought Albert Adomah down, only for Ramirez to beat the QPR goalkeeper to the corner to put Boro ahead again.

Gibson added a third, again meeting a Leadbitter corner, as the visitors took control, but after Poulter had an effort ruled out in the 71st minute – Hoilett’s cut-back pass was judged to have gone over the byeline – QPR looked increasingly menacing.

Chery beat Dimi Konstantopoulos with a powerful effort with five minutes remaining, but Boro held on.

Queens Park Rangers boss Jimmy Floyd Hasselbaink:

“I think in the first half we controlled the game, but they are a very good side and that is why they are where they are.

“They scored because of a mistake and then in the second half I was disappointed with how we started.

“Their first 10 minutes of the second half was better than ours and we couldn’t keep the ball, which we had been doing really well.

“But the most disappointing thing was that we got two goals against us from set-pieces. We know these moments in games are very important.”

Middlesbrough boss Aitor Karanka:

“It’s another massive three points and it was another typical Championship game.

“We were playing a team in mid-table but they wanted every single ball and were fighting, but my team were really good.

“In the first 25 minutes of the second half we played really well. They caused us some problems but we are a consistent team and we won another three points that are really important for us.

“We made a few mistakes to be in the position we are now in – in January we were in a really good position. Now we can’t make any more mistakes. We have to keep going.”