A memorable strike from substitute Albert Adomah secured a vital victory for Bristol City and lifted them off the foot of the Championship.
The Ghanaian found the top corner from 18 yards before Steven Davies added a second shortly after the break as City continued their unbeaten run at Ashton Gate since Sean O'Driscoll took charge.
Middlesbrough, without an away win since 8 December, struggled throughout.
The result leaves Tony Mowbray's men three points off the play-off spots.
City made the brighter start, with Marvin Elliott teeing up Neil Kilkenny early on, only for Boro goalkeeper Jason Steele to keep his curling effort out.
The visitors tried their luck with a long-range shot but Tom Heaton, who had kept back-to-back clean sheets in his previous matches, was not troubled by Marvin Emnes's ambitious drilled effort.
When Jon Stead picked up a knock, O'Driscoll turned to Adomah, whose opportunities have been limited to late cameos since returning from the Africa Cup of Nations.
It was not long before the Ghana international latched onto Kilkenny's raking 40-yard pass and curled the ball into the top corner off the inside of the post.
Middlesbrough did respond, first when Mustapha Carayol shot over the crossbar, then when Elliott headed over on the stroke of half-time.
But seven minutes into the second half, City doubled their lead as Davies latched onto a quickly-taken free-kick and fired the ball home from an angle.
City felt they should have been awarded a penalty when Davies's shot hit Rhys Williams' hand inside the box, while Adomah turned creator on 74 minutes to fashion a chance for Elliott, who could only drill a first-time effort wide.
Middlesbrough boss Tony Mowbray: "I have to put a positive spin on our position because if we were just off the play-off places having been mid-table all season we would be happy enough.
"Because we have fallen away from the top of the table since the New Year, in a similar way to last season, there is a lot of negativity and I have to turn that around. "
Bristol City head coach Sean O'Driscoll: "I can't fault the players since I have been at the club.
"They understand what we are trying to do, but it is one thing to talk about a plan and another to do what is necessary to carry it out.
"I never look at the league table because I don't believe there is any point. I believe in keeping on with the same emphasis on the basics and getting my team organised whatever position they are in. When we lose the ball we look to get it back as quickly as possible."