Sheffield Wednesday's fine recent record against Middlesbrough came to an end at Hillsborough as the Teessiders came away with a 3-1 win.
Adam Friend had Boro in front before Wednesday upped their game after the restart and equalised through Marco Matias, his second successful league goal.
However, the visitors' stronger attacking line came to the fore and Diego Fabbrini put Boro back into the lead soon after.
And the victory was completed in the last minute when substitute Cristhian Stuani stroked home.
Head coach Carlos Carvalhal said: "We gave a lot to make it 1-1 and after they scored again, it was difficult for us. It had a big impact on our players and it was very hard after that.
"The big lesson we must take from the game is that we must play from the beginning."