New Barnsley manager Mark Robins celebrated his first victory in charge when they stunned Pride Park to record a first win of the season.
Although Derby took the lead through Rob Hulse, the visitors showed spirit and character to hit back through Adam Hamill and second-half goals from Andy Gray and Anderson Silva sealed the points.
Shaun Barker headed Derby's second but, by then, a large section of the Derby fans had headed for the exits.
Derby manager Nigel Clough had called for a better service from his wide players and Lee Croft delivered in the 27th minute.
Croft whipped in a cross from the right that had pace and bend on the ball and Hulse headed powerfully past David Preece.
Hulse should have scored again seven minutes later when Croft sent in another excellent cross but, to the astonishment of everyone inside Pride Park, including Clough, the striker completely missed the ball.
Barnsley had passed the ball around without looking dangerous but in the 37th minute they drew level with a brilliant effort from Hamill.
The midfielder was given the space on the left edge of the penalty area to line up a right-foot shot which curled inside Stephen Bywater's post.
It got even better for Barnsley in the 58th minute when Derby were caught out by a swift counter-attack, although the home side were convinced Kris Commons was fouled at the start of the move.
But referee Nigel Miller waved play on and Barnsley swept upfield to send Gray in to slide a low shot past Bywater.
Derby huffed and puffed without creating a clear chance and it was Barnsley who scored again in eight minutes of stoppage time.
Substitute Silva broke clear on the Derby right and showed real composure to take the ball round Bywater and Paul Connolly on the line before sliding it in.
Derby pulled a goal back when Barker headed in a Gary Teale corner, but it was too late to save Derby from a second home defeat in four days.