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.
Peterborough's dismal run
Posh have not won a Championship game since defeating Derby 3-0 on 27 October. Since then they have lost seven matches and drawn one
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."
- 01 Olejnik
- 05 Zakuani
- 19 Little
- 06 Bostwick
- 14 Rowe (Ferdinand - 78' )
- 17 Newell
- 20 Knight-Percival (Swanson - 90' )
- 33 Thorne
- 08 Tomlin Booked
- 10 Boyd
- 34 Gayle
- 13 Day
- 03 Alcock
- 04 Brisley
- 07 Swanson
- 11 McCann
- 16 Kearns
- 18 Ferdinand
- 01 Steele
- 03 Bikey
- 21 Parnaby
- 39 Woodgate
- 07 Leadbitter
- 16 McEachran (Thomson - 78' )
- 18 Halliday
- 38 Haroun (Smallwood - 69' )
- 09 Emnes (Miller - 73' )
- 11 Ledesma
- 27 McDonald
- 32 Leutwiler
- 15 Hines
- 08 Thomson
- 10 Bailey
- 33 Smallwood
- 17 Jutkiewicz
- 30 Miller
Ref: Carl Berry