Swansea City fell to defeat at the Liberty Stadium as Tom Lawrence netted the winner for Derby in a thrilling contest.
Despite a bright start, the Swans had fallen behind when Martyn Waghorn tapped in after Freddie Woodman had tipped a Lawrence strike onto the post.
The Swans trailed until the break but hit back to lead as quickfire strikes from Yan Dhanda and Kyle Naughton turned the game around.
However, Derby hit back as Duane Holmes drilled in an equaliser, before Wales international Lawrence fired in the winner to break Swansea hearts.
Connor Roberts – back from a shoulder problem - and Wayne Routledge had come into the Swans side in place of Jake Bidwell and the injured Bersant Celina respectively.
The Swans so nearly led inside four minutes. Some slick build-up saw Conor Gallagher’s backheel find Roberts’ advanced run but neither George Byers or Rhian Brewster could apply the finishing touch with keeper Ben Hamer in no-man’s land.
But it was the visitors who hit the front in the eighth minute. Lawrence was given time to get a shot away from the edge of the box, Freddie Woodman could only parry it onto the inside of the post and Waghorn was following up to tap-in the rebound.
The Swans sought a quick response, Andre Ayew firing wide after nice link work with Brewster had sent the Ghanaian striding free down the right.
Ayew was having plenty of joy down the right, and he wriggled away from his marker to pull a ball back, but Routledge was unable to make clean contact as it fell to him.
However, the game became rather scrappy after that frantic opening, although it was enlivened with Gallagher gave Wayne Rooney and Hamer a hurry-up as they dallied with the ball around their own box.
Ayew narrowly failed to beat Hamer to an inviting cross from Routledge, with the Swans enjoying the better of possession and territory and offering a real threat down the flanks.
Hamer did well to palm away a Joe Rodon header after the centre-back had strongly met a Matt Grimes free-kick but the Swans went in a goal down at the break.
They pressed again after the interval – with Dhanda on for Byers, a lovely ball from Roberts finding Routledge, but the winger trod on the ball as Hamer rushed out to meet him.
Chances were coming thick and fast but Swansea could not take them. Routledge had his effort block after a lovely turn and feed from Gallagher, before Brewster and Roberts failed to make meaningful contact inside the six-yard box as an Ayew header fell for them.
But the goal finally came with 56 minutes on the clock, Dhanda seized the ball after good work by Routledge and drove forward to curl a lovely shot into the bottom corner.
And barely two minutes later the hosts led as Ayew dug out a cross which Hamer got to but could not hold.
Brewster beat the keeper to the ball, and Naughton kept his head to fire into the net.
However, the lead lasted just five minutes. Holmes firing home from the edge of the area after the Swans had failed to clear a free-kick.
The contest was now a frantic end-to-end affair, and Andre Wisdom was fortunate to only get a booking after a high challenge on Woodman as the keeper cleared a throughball.
Brewster fired wide after a mazy run from halfway against a retreating defence, and the Swans committed numbers forward.
But they were dealt a cruel blow as Routledge’s pass was picked off by Max Bird to start a Derby counter that ended with Lawrence smashing home from the edge of the area.
Swansea City: Freddie Woodman; Connor Roberts, Joe Rodon, Marc Guehi, Kyle Naughton; George Byers (Yan Dhanda 46), Matt Grimes (captain), Conor Gallagher; Andre Ayew, Wayne Routledge (Liam Cullen 86); Rhian Brewster.
Substitutes not used: Erwin Mulder, Ben Wilmot, Jake Bidwell, Jay Fulton, Nathan Dyer.
Derby County: Ben Hamer, Andre Wisdom, Craig Forsyth, Martyn Waghorn, Tom Lawrence (Jack Marriott 88), Matthew Clarke, Duane Holmes, Wayne Rooney (captain), Jayden Bogle (Curtis Davies 60), Jason Knight (Graeme Shinnie 60), Max Bird.
Substitutes not used: Chris Martin, Kelle Roos, Scott Malone, Morgan Whittaker.
Referee: Matthew Donohue