Brentford secured a first win at Middlesbrough since 1938 and this was just their second Championship away win of the season.
Brentford moved to within six points of the play-off places after an own goal from Boro defender Ryan Shotton with 20 minutes remaining was followed by Said Benrahma’s winner three minutes later.
Boro had taken a sixth-minute lead courtesy of Ashley Fletcher’s second league goal of the campaign.
Tony Pulis’s side are 12 points off a top-two spot, with Norwich, Leeds and Sheffield United all recording victories.
Pulis was criticised by supporters for taking off striker Britt Assombalonga and replacing him with full-back George Friend when Middlesbrough led.
But the Boro chief was also disappointed with the performance of referee Jeremy Simpson for not giving any of three decent penalty shouts. Fletcher could also have headed in a second.
Pulis said: “We are disappointed. They are a good side, three or four players would be in any team in this division. We should have had three definite penalties. At home, you think you might get them, or at least one.
“It wasn’t a popular decision (taking Assombalonga off). I didn’t think Britt looked sharp, quite at it like he has been. If I messed up, I messed up. People can look at my decisions and say I have made the wrong decision and I have no problem with that.”
Middlesbrough: Randolph, Ayala, Shotton, Fry, Howson, Mikel, Besic (Hugill 74), Saville (Tavernier 88), Wing, Fletcher, Assombalonga (Friend 62). Unused substitutes: Konstantopoulos, Clayton, McNair, Downing.
Brentford: Bentley (Gunnarsson 75), Konsa, Sorensen, Barbet, Dalsgaard, Mokotjo, Sawyers, Odubajo, Canos (Marcondes 84), Maupay, Benrahma (Watkins 79). Unused substitutes: Da Silva, Forss, Oksanen.
Referee: J Simpson (Lancashire).