Bristol City upset Middlesbrough at a foggy Riverside Stadium to end their 11-game winless run and climb out of the Championship relegation zone.
The Robins took a shock lead through an Albert Adomah close-range finish that slipped under Boro keeper Jason Steele.
Ishmael Miller fired in following Grant Leadbitter's corner to equalise, but Neil Danns teed up Stephen Pearson to restore the visitors' advantage.
Substitute Steven Davies curled in from Adomah's pass to wrap up the points.
It was City's first victory since September 18 and moved them above Ipswich and Sheffield Wednesday into 21st place.
They opened the scoring when Joe Bryan got to the byline and fed Adomah, whose effort from just inside the six-yard box squirmed through Steele.
Four minutes later, Boro striker Lukas Jutkiewicz had a fine chance to equalise but headed wide when from Miller's cross.
Ryan Taylor was causing the Boro defence problems and he felt he should have had a penalty, believing he was fouled by Andre Bikey.
But it was not given and Boro equalised when Miller fired home his third goal of the season from close range after a Leadbitter corner was not cleared.
The fog thickened as the second half began and both sides had decent chances despite the poor conditions.
City keeper Tom Heaton punched the ball against his own post before Neil Kilkenny hacked the ball clear.
At the other end Adomah came close to a second of the afternoon before the lead was restored as Leicester loanee Danns supplied Pearson and he fired home from inside the box.
Heaton had to make a top-class save to deny substitute McDonald to keep the advantage intact, and with two minutes left Davies converted his eighth goal of the season from Adomah's pass.
Middlesbrough boss Tony Mowbray: "The result was disappointing and frustrating but that is down to the way we performed, and it must be said, the way Bristol performed. They played well on the counter.
"Things just didn't go to plan. We went more direct and it didn't pan out. We changed the shape for the right reasons but it didn't come off.
"But you can't over-analyse it. We are still in the top six and there are still plenty of games to play. Luckily we have another one here on Tuesday night against Huddersfield, so we can put it right quickly."
Bristol City manager Derek McInnes: "We played well at times in the early part of the campaign but that was as good a performance as we have put in all season. I was delighted for the lads and for the supporters.
"We expected Middlesbrough to attack us with the two men up front and we knew it would be tough, we knew we would have to work hard and keep our shape.
"We did that. I thought we contained them well and I thought we controlled the game for long spells and with that came a bit of confidence.
"That showed in how we attacked. We scored three very good goals. We got into some very good areas and created some good chances."
Sorry, we were unable to load match stats, please try again.
Live Text Commentary
Full Time The final whistle is blown by the referee.90:00 +3:32 Substitution
Substitution Danny Wilson replaces Joe Bryan.90:00 +3:10
Shot by Justin Hoyte from deep inside the penalty area misses to the right of the goal.90:00 +0:51
Free kick awarded for a foul by Liam Fontaine on Scott McDonald. Emmanuel Ledesma produces a shot on goal direct from the free kick,89:43
The assistant referee flags for offside against Steven Davies. Jason Steele takes the free kick.89:08
Unfair challenge on Joe Bryan by Emmanuel Ledesma results in a free kick. Tom Heaton takes the indirect free kick.88:05
Assist on the goal came from Albert Adomah.88:05 Goal scored
Goal! - Steven Davies - Middlesbro 1 - 3 Bristol C Steven Davies scores a goal from inside the six-yard box to the bottom left corner of the goal. Middlesbrough 1-3 Bristol City.85:19
Unfair challenge on Liam Fontaine by Scott McDonald results in a free kick. Free kick taken by Tom Heaton.84:26 Substitution
Substitution Steven Davies on for Ryan Taylor.81:49
Shot from deep inside the area by Kevin Thomson clears the crossbar.79:45
Short corner taken by Scott McDonald.78:33 Substitution
Substitution (Bristol City) makes a substitution, with Martyn Woolford coming on for Neil Kilkenny.78:06
Marvin Emnes produces a cross, save made by Tom Heaton.76:52 Booking
Booking Caution for Andre Bikey.75:45
Emmanuel Ledesma takes the free kick.75:45 Booking
Booking Stephen Pearson goes into the book for unsporting behaviour.75:34
Free kick awarded for a foul by Stephen Pearson on Kevin Thomson.73:13
The referee blows for offside. Free kick taken by Tom Heaton.71:44 Substitution
Substitution Luke Williams on for Ishmael Miller.
Free kick awarded for a foul by Grant Leadbitter on Marvin Elliott. Free kick taken by Albert Adomah.70:17
Ishmael Miller is caught offside. Tom Heaton restarts play with the free kick.69:30
Neil Danns produces a right-footed shot from inside the area that clears the crossbar.68:33
Andre Bikey challenges Albert Adomah unfairly and gives away a free kick. Neil Kilkenny restarts play with the free kick.67:08
Scott McDonald takes a shot. Tom Heaton makes a brilliant save.64:41
Corner taken by Grant Leadbitter.64:09
Liam Fontaine restarts play with the free kick.64:09 Booking
Booking Booking for Grant Leadbitter for unsporting behaviour.63:39
Free kick awarded for a foul by Kevin Thomson on Neil Danns.62:33
Assist by Neil Danns.62:33 Goal scored
Goal! - Stephen Pearson - Middlesbro 1 - 2 Bristol C Stephen Pearson gets on the score sheet with a goal from close in to the bottom left corner of the goal. Middlesbrough 1-2 Bristol City.60:19 Substitution
Substitution Scott McDonald replaces Lukas Jutkiewicz.60:19 Substitution
Substitution Kevin Thomson comes on in place of Josh McEachran.58:44
Free kick awarded for a foul by Seb Hines on Marvin Elliott. Free kick taken by Neil Kilkenny.57:50
Inswinging corner taken by Emmanuel Ledesma from the right by-line, Close range header by Andre Bikey goes over the crossbar.56:41
Ishmael Miller takes a shot. Save by Tom Heaton.56:16
Corner taken right-footed by Grant Leadbitter from the right by-line, Tom Heaton makes a save.56:04
Ishmael Miller takes a shot. Richard Foster gets a block in.55:30
Effort from deep inside the area by Neil Kilkenny clears the bar.53:07
Albert Adomah takes a shot.52:39
Inswinging corner taken by Grant Leadbitter, clearance made by Richard Foster.51:24
Liam Fontaine challenges Ishmael Miller unfairly and gives away a free kick. Emmanuel Ledesma takes the indirect free kick.50:11
Shot from deep inside the area by Ishmael Miller clears the bar.48:28
Lukas Jutkiewicz produces a right-footed shot from deep inside the penalty area which goes wide of the left-hand post.47:28
Joe Bryan crosses the ball.45:01
The second half kicks off.45:00 +1:10 Half time
Half Time The match has reached half-time.43:53
Corner from right by-line taken by Emmanuel Ledesma.42:47
Emmanuel Ledesma produces a right-footed shot from the edge of the area and misses to the left of the goal.42:01
Stephen Pearson gives away a free kick for an unfair challenge on Stuart Parnaby. Jason Steele restarts play with the free kick.41:26
Corner taken by Emmanuel Ledesma from the left by-line, Tom Heaton makes a save.39:50
Corner taken right-footed by Grant Leadbitter, save by Tom Heaton.39:35
Marvin Emnes takes a shot. Blocked by Marvin Elliott.38:12
Inswinging corner taken from the right by-line by Joe Bryan, Stephen Pearson produces a header from deep inside the six-yard box that clears the bar.37:50
Richard Foster delivers the ball, Albert Adomah takes a shot. Save by Jason Steele.34:42
Assist by Lukas Jutkiewicz.34:42 Goal scored
Goal! - Ishmael Miller - Middlesbro 1 - 1 Bristol C Ishmael Miller gets on the score sheet with a goal from close range low into the middle of the goal. Middlesbrough 1-1 Bristol City.33:00
Grant Leadbitter takes the inswinging corner,32:39
Corner taken by Emmanuel Ledesma, clearance by Ryan Taylor.32:20
Corner taken by Grant Leadbitter, save by Tom Heaton.32:12
The ball is crossed by Marvin Emnes, clearance made by Louis Carey.32:01
Stuart Parnaby produces a cross.29:24
Andre Bikey takes the free kick.29:24 Booking
Booking Liam Fontaine receives a caution for dissent.29:11
Foul by Neil Danns on Ishmael Miller, free kick awarded.28:28
Lukas Jutkiewicz challenges Louis Carey unfairly and gives away a free kick. Free kick taken by Tom Heaton.28:16
The ball is crossed by Joe Bryan.26:50
The ball is crossed by Stuart Parnaby.26:08
Stuart Parnaby crosses the ball, Liam Fontaine manages to make a clearance.25:05
Effort on goal by Stephen Pearson from inside the penalty area goes harmlessly over the bar.24:27
Unfair challenge on Marvin Emnes by Neil Danns results in a free kick. Grant Leadbitter takes the free kick.23:13
Unfair challenge on Neil Kilkenny by Grant Leadbitter results in a free kick. Neil Kilkenny restarts play with the free kick.22:28
The offside flag is raised against Emmanuel Ledesma. Tom Heaton restarts play with the free kick.21:01
Grant Leadbitter takes the inswinging corner, save made by Tom Heaton.19:31
Ishmael Miller is ruled offside. Tom Heaton takes the free kick.18:51
Inswinging corner taken by Neil Kilkenny, Andre Bikey manages to make a clearance.18:13
Inswinging corner taken right-footed by Neil Kilkenny.18:03
The ball is sent over by Albert Adomah, Lukas Jutkiewicz gets a block in.17:22
Foul by Stuart Parnaby on Ryan Taylor, free kick awarded. Joe Bryan restarts play with the free kick.16:43
The ball is delivered by Ishmael Miller, Lukas Jutkiewicz has a headed effort at goal from close in which goes wide right of the target.12:40
Joe Bryan provided the assist for the goal.12:40 Goal scored
Goal! - Albert Adomah - Middlesbro 0 - 1 Bristol C Albert Adomah finds the back of the net with a goal from close in to the bottom left corner of the goal. Middlesbrough 0-1 Bristol City.11:21
Grant Leadbitter takes a shot. Save made by Tom Heaton.9:56
Inswinging corner taken right-footed by Emmanuel Ledesma from the right by-line, Tom Heaton makes a save.9:41
Lukas Jutkiewicz crosses the ball, Louis Carey makes a clearance.5:20
The referee blows for offside against Lukas Jutkiewicz. Free kick taken by Tom Heaton.3:19
Inswinging corner taken from the left by-line by Albert Adomah.2:21
Ishmael Miller takes a shot. Save made by Tom Heaton.1:48
A cross is delivered by Emmanuel Ledesma, clearance made by Liam Fontaine.0:00
The referee gets the game started.
Live data and text provided by our data suppliers