A stunning injury-time free-kick from Malaury Martin earned Middlesbrough all three points at Bristol City and moved Boro up to third in the Championship.
The Frenchman's 30-yard effort gave David James no chance on his 750th league appearance.
The goal ended City's six-game unbeaten run but it could have been different.
The home side felt they should have been awarded a penalty when Julio Arca handled in the area but the referee waved away the protests.
Tony Mowbray's Middlesbrough side have struggled for goals in recent weeks, after failing to score in six of their previous 12 matches.
They huffed and puffed at Ashton Gate and had goalkeeper Jason Steele to thank for keeping them in the match.
He made a point-blank save from Nicky Maynard in the first half and then scrambled a shot from Brett Pitman off the line late on as City went in desperate search of the win.
At the other end James had a relatively quiet 90 minutes but could do nothing to stop the rocket from Martin, who scored only his second goal since signing for Boro in the summer.
Sorry, we were unable to load match stats, please try again.
Live Text Commentary
Full Time The referee ends the match.90:00 +4:47
Corner crossed in by Ryan McGivern.90:00 +3:52
Free kick awarded for an unfair challenge on Kalifa Cisse by Scott McDonald. Neil Kilkenny takes the direct free kick.90:00 +3:03 Booking
Booking Tony McMahon goes into the book for dissent.90:00 +2:07
Brett Pitman produces a right-footed shot from just outside the box that misses to the right of the goal.90:00 +0:07
Assist on the goal came from Marvin Emnes.90:00 +0:07 Goal scored
Goal! - Malaury Martin - Bristol C 0 - 1 Middlesbro Malaury Martin finds the net with a goal direct from the free kick from long range to the top right corner of the goal. Bristol City 0-1 Middlesbrough.89:25
James Wilson concedes a free kick for a foul on Marvin Emnes.86:31 Substitution
Substitution Stephen McManus replaces Rhys Williams.86:08
A cross is delivered by Justin Hoyte, clearance by Liam Fontaine.83:40
Corner taken right-footed by Tony McMahon from the right by-line, James Wilson makes a clearance.83:11
Outswinging corner taken by Tony McMahon, Ryan McGivern manages to make a clearance.82:48
Free kick awarded for a foul by Kalifa Cisse on Rhys Williams. Tony McMahon restarts play with the free kick.82:33
Joe Bennett crosses the ball, James Wilson makes a clearance.80:08
Nicky Maynard is flagged offside by the assistant referee. Free kick taken by Jason Steele.79:14
The ball is sent over by Tony McMahon, clearance made by James Wilson.78:34
The ball is delivered by Tony McMahon.76:01 Substitution
Substitution (Middlesbrough) makes a substitution, with Malaury Martin coming on for Julio Arca.74:55
Nicky Maynard has an effort at goal from just inside the box that misses to the right of the target.74:17
Brett Pitman takes a shot. Save made by Jason Steele.
The ball is delivered by Justin Hoyte, Liam Fontaine makes a clearance.72:54
Effort from the edge of the penalty area by Marvin Emnes goes wide of the left-hand post.71:08
Neil Kilkenny restarts play with the free kick.71:08 Substitution
Substitution Brett Pitman comes on in place of Stephen Pearson.71:08
Free kick awarded for an unfair challenge on Albert Adomah by Julio Arca.69:39
The ball is delivered by Yannick Bolasie, Rhys Williams makes a clearance.68:25
Unfair challenge on Faris Haroun by Ryan McGivern results in a free kick. Julio Arca has an effort direct from the free kick, clearance made by Kalifa Cisse.66:01
Corner taken by Tony McMahon, Faris Haroun takes a shot. David James makes a save.65:46
Julio Arca takes a shot. Albert Adomah gets a block in.65:09
Outswinging corner taken from the right by-line by Tony McMahon.62:42
Shot from just outside the box by Marvin Emnes goes over the target.62:23
Centre by Justin Hoyte, James Wilson manages to make a clearance.61:49
Albert Adomah takes a shot. Save by Jason Steele.60:58 Substitution
Substitution Yannick Bolasie is brought on as a substitute for Martyn Woolford.60:41
Martyn Woolford has an effort from just inside the box that misses to the left of the goal.60:11
Marvin Emnes takes a shot. Save by David James.59:47
Faris Haroun sends in a cross, save by David James.58:52
The ball is delivered by Albert Adomah, Rhys Williams gets a block in.57:36
The ball is crossed by Joe Bennett, Close range header by Faris Haroun goes over the crossbar.56:41
Scott McDonald challenges Liam Fontaine unfairly and gives away a free kick. Free kick taken by Liam Fontaine.54:55
Stephen Pearson crosses the ball, Matthew Bates manages to make a clearance.53:04
The ball is sent over by Faris Haroun.50:41
Faris Haroun has an effort at goal from long range that goes wide left of the upright.49:55
Justin Hoyte takes a long range shot harmlessly clearing the crossbar.49:35
Inswinging corner taken right-footed by Tony McMahon from the left by-line, Kalifa Cisse manages to make a clearance.48:54
Shot on goal comes in from Nicky Bailey from the free kick.48:54 Booking
Booking Neil Kilkenny shown a yellow card.48:14
Scott McDonald fouled by Liam Fontaine, the ref awards a free kick.46:02
Free kick awarded for a foul by Kalifa Cisse on Julio Arca. Free kick taken by Nicky Bailey.45:01
The referee starts the second half.45:00 +2:24 Half time
Half Time The ref blows to signal half-time.45:00 +1:34
Outswinging corner taken right-footed by Neil Kilkenny, Julio Arca manages to make a clearance.45:00 +1:25
The ball is delivered by Albert Adomah, clearance made by Joe Bennett.43:54
Albert Adomah delivers the ball, Matthew Bates manages to make a clearance.42:26
The referee blows for offside. Liam Fontaine takes the free kick.42:11
Cole Skuse sends in a cross, Jason Steele makes a save.40:14
Nicky Maynard takes a shot. Blocked by Rhys Williams.37:24
Kalifa Cisse concedes a free kick for a foul on Scott McDonald. Free kick taken by Nicky Bailey.35:07
The ball is sent over by Joe Bennett, Headed effort from deep inside the penalty area by Scott McDonald misses to the right of the target.34:38
Nicky Maynard concedes a free kick for a foul on Rhys Williams. Rhys Williams takes the free kick.34:29
Justin Hoyte crosses the ball, James Wilson manages to make a clearance.34:03
A cross is delivered by Ryan McGivern, clearance by Nicky Bailey.31:30
Corner taken by Tony McMahon, David James makes a save.26:12
Effort from just outside the area by Julio Arca goes over the bar.24:47
Scott McDonald is ruled offside. Liam Fontaine takes the indirect free kick.23:00
Tony McMahon takes the inswinging corner, James Wilson manages to make a clearance.22:35
Rhys Williams takes a shot. Liam Fontaine gets a block in.21:12
Foul by Kalifa Cisse on Nicky Bailey, free kick awarded. Tony McMahon crosses the ball in from the free kick, clearance made by Stephen Pearson.19:46
The official flags Albert Adomah offside. Free kick taken by Jason Steele.13:18
Nicky Maynard takes a shot. Save by Jason Steele.12:49
Cole Skuse sends in a cross, Martyn Woolford produces a volleyed left-footed shot from 6 yards. Save by Jason Steele.11:08
Nicky Maynard takes a shot. Save made by Jason Steele.9:43
Shot on goal by Neil Kilkenny from long range goes harmlessly over the target.8:07
Foul by Kalifa Cisse on Scott McDonald, free kick awarded. Nicky Bailey takes the free kick.7:23
Corner taken right-footed by Tony McMahon, Kalifa Cisse manages to make a clearance.7:08
A cross is delivered by Justin Hoyte, Rhys Williams manages to make a clearance.5:53
The ball is sent over by Joe Bennett.4:36
The referee blows for offside against Scott McDonald. Liam Fontaine takes the indirect free kick.2:21
Joe Bennett produces a cross, David James makes a comfortable save.0:00
The referee gets the match started.
Live data and text provided by our data suppliers