Barnsley came from behind with two goals in nine second half minutes to claim a sensational win as Middlesbrough slipped to their fourth defeat in five outings.
Justin Hoyte gave the visitors a first-half lead but Barnsley struck early in the second half with goals from Stephen Foster and Hugo Colace.
Barnsley, who started the game unbeaten in seven league matches, almost fell to an early Boro strike when Julio Arca hit a super shot, but Luke Steele was alert and dived full stretch to turn it away.
But when the home side won a free-kick 20 yards out midfielder Emil Hallfredsson dipped a free-kick over the wall only to be denied by Danny Coyne.
The Iceland international made a blunder soon afterwards and Boro almost profited when Justin Hoyte pounced but fired wide.
It was Hoyte who gave the visitors the lead after 24 minutes in bizarre fashion when he hit a long cross from close to the touchline. With Steele well off his line it drifted over the keeper and into the top corner as Hoyte claimed his first ever Boro goal.
Hallfredsson tried an ambitious attempt to level just before the break but his long-range shot was well wide.
Two goals in nine minutes from Barnsley early in the second half rocked the visitors and had the home fans in ecstasy.
Boro somehow survived when David Wheater cleared off the line when Stephen Foster's header from a free kick looked to be over the line.
But the Barnsley breakthrough came in the 50th minute when Hallfredsson's corner to the near post was flicked by the boot of Daniel Bogdanovic and Foster was first to it and headed in the equaliser.
The same pair combined to provide the goal that gave Barnsley a 59th minute lead. Hallfredsson fed Bogdanovic whose cross from the left was headed in by Colace.
As Boro looked for a way back Steele had to produce an excellent save when Gary O'Neil crashed a shot goalwards following another Barnsley mistake.
And in a high energy end to the game Boro piled on the pressure forcing Barnsley to defend deep but they hung on to claim the win.