Faris Haroun marked his return from injury with two goals as Middlesbrough strengthened their promotion push with victory at bottom club Peterborough.
Haroun, 27, opened the scoring with a cool finish to a swift counter-attack before heading Boro into a 2-0 lead.
Dwight Gayle, on loan from Dagenham and Redbridge, reduced the deficit with a right-foot finish before equalising from a corner.
But Ishmael Miller hit Boro's winner with a speculative 15-yard effort.
While Peterborough are five points from safety after eight matches without a win, Middlesbrough are three points behind second-placed Crystal Palace.
Haroun had missed the last four matches with a calf injury but was clearly eager to make up for lost time.
The midfielder broke the deadlock in the ninth minute with a composed finish after Scott McDonald's pass.
It was 2-0 just 11 minutes later, Haroun meeting Stuart Parnaby's cross from the right before Gayle gave the hosts hope with a thumping finish seven minutes before the break.
Peterborough were level when Gayle prodded home Lee Tomlin's corner but substitute Miller had the final say 14 minutes from time.
Peterborough manager Darren Ferguson: "When we equalised I felt sure there would only be one winner, but unfortunately it wasn't to be.
"There's no doubt in my mind we deserved to win it but we have conceded three very poor goals.
"But there are a lot of positives to take from our performance and we'll certainly win games if playing to that standard on a regular basis.
"We have 25 matches to turn our season around."
Middlesbrough manager Tony Mowbray: "We came here to win, we would have been disappointed to draw and yet we could even have lost.
"It was all about the three points and we got them in the end.
"The fact that Peterborough are bottom shows just how strong the Championship is as a league."