David Nugent's first goal for Derby earned Steve McClaren's team a 2-1 victory over Barnsley, whose fading play-off hopes were dealt a blow at Pride Park.
Matty James headed the visitors in front early in the second half, but Tom Ince replied before Nugent pounced on a defensive error to give Derby a first win in seven games.
Derby had switched to a 4-2-3-1 formation to try and get back on track, with Matej Vydra making his first start since early January, and the Czech forward had an early chance to make an impact when he got behind Barnsley on the left, but could not quite pull the ball back.
Barnsley had a better opening in the 11th minute when Tom Bradshaw ran into the area on the right. His scuffed shot was taken on by Adam Armstrong, whose low drive went just past the far post.
Armstrong was in again, this time on the left, four minutes later and forced Scott Carson to turn his shot behind for a corner.
Barnsley were breaking dangerously and won a free-kick just outside the area when Adam Hammil was tripped. Hamill's attempt struck the top of the wall, but Derby's new formation was looking far from convincing.
However, at the other end a poor clearance by Andy Yiadom allowed Johnny Russell to whip in a cross which just evaded Vydra at the back post.
Yiadom was booked for a foul on Julie de Sart and then lost out to Russell in the 31st minute, but the Scot's shot hit Adam Davies and was cleared before De Sart's 25-yard drive forced him into a more routine save.
Ince fired over as Derby finally found some rhythm and the first half ended with the home side putting pressure on Barnsley, who were giving the ball away cheaply.
Derby made a change at half-time, with De Sart replaced by Jacob Butterfield, but the home side went behind in the 52nd minute when a long throw by Marc Roberts was headed in by James.
The response, though, was immediate. Derby equalised two minutes later when Cyrus Christie crossed from the right and the ball fell to Ince who slammed a shot past Davies from 10 yards.
Ince had a free-kick touched over in the 58th minute, but Barnsley broke dangerously from the corner and James had a shot charged down.
Derby went close when Davies pushed an Ince shot onto the post in the 70th minute and the keeper made another vital save two minutes later when he turned over a Russell drive.
And the hosts went ahead in the 76th minute when a poor clearance fell to Nugent who drilled in a low shot from 15 yards.
Only a goal-line block by Alex Mowatt denied Christie a third three minutes later. Barnsley had a chance in stoppage time, but Ryan Kent's shot was straight at Carson and Derby held on for a long overdue victory.
Derby boss Steve McClaren:
"It's a big win for us and I have to say it was fantastic character from 1-0 down from a long throw and everyone could have gone down. It was important to react quickly which we did and then it was quite an open game, but we got the goal and then hung on at the end.
"It's a big three points in terms of reaction. We said we've just lost two in a row for the first time since I've come back, we do not make it three and the players have done well to make sure of that."
Barnsley boss Paul Heckingbottom:
"I probably know my team better than anyone, the players are an honest bunch and they are disappointed with the two goals we have conceded. I'm disappointed with a few performances in that we weren't positive enough and didn't have a big enough effect on the game to make us win it.
"If you think you are conceding sloppy goals and some of your players aren't at their best, the fact we've lost 2-1 and could have got something out of the game shows how far we've come."