Bristol City 1 Middlesbrough 2
Liam Fontaine gave the Robins the lead when he went up for a free-kick but, after Stewart Downing had equalised, David Wheater grabbed the second-half winner.
Boro made an untidy start giving away too many free-kicks and collecting a yellow card for Lee Cattermole after he lunged at City's acting captain Jamie McAllister.
It was another foul, this time on link man David Noble, which gave the Premier League side a touch of danger as Bristol grabbed an 18th minute lead.
From the edge of the centre circle, Bradley Orr lifted his kick into the penalty area. Hungarian Tamas Vasko headed down and Fontaine was there to urge it over the line as Luke Young slid in with him.
Gareth Southgate would have been unhappy at the quality of a defence missing the injured Jonathan Woodgate, but in fact the goal galvanised his side.
The dithering faded, Fabio Rochemback stopped looking over-worked, and Boro smoothly started to take control.
Cattermole was called on to make an important challenge just inside the box to smother a shot from Marvin Elliott but the bounce of play had shifted away from the home side.
They were over-elaborating and their short passing style got them into trouble, a defensive muddle handing Downing the equaliser.
Bristol City's Brazilian keeper, Adriano Basso, will have been blamed in the dressing room for letting the ball in at his near post but it was a collective failure.
City knew it and so did Middlesbrough as they set out to tighten the screw in the second half.
Bristol City still had their moments. Mark Schwarzer had to pull down a free-kick from Lee Johnson under his bar and City won a corner when he fumbled a shot from Ivan Sproule.
But the winner when it came on 72 minutes was both incisive and clinical.
Young's pass down the right split the defence, Cattermole's centre widened the gap and Wheater steamed in to book Boro's place in the fourth round.