Martyn Waghorn held his nerve to score the penalty which saved Derby from relegation and sent Sheffield Wednesday down to Sky Bet League One as a pulsating game at Pride Park ended 3-3.
Waghorn also headed an equaliser after Sam Hutchinson put Wednesday ahead in first-half stoppage time before Patrick Roberts gave Derby the lead.
Callum Paterson levelled and Julian Borner restored Wednesday’s lead but Waghorn had the final say when substitute Kamil Jozwiak was fouled by Chey Dunkley.
Wednesday had been boosted by the sight of Darren Moore in the technical area for the first time since his recovery from Covid-19 and he saw his side go close when Barry Bannan fired over.
Derby almost scored when Colin Kazim-Richards flicked on a corner but Waghorn headed wide at the back post and needed lengthy treatment after colliding with the upright.
It looked a serious injury with the striker face down in the net but, after a delay of several minutes, he was able to continue in a game littered with fouls and mistakes.
Waghorn thought he was through in the 29th minute only to be flagged offside and Adam Reach fired over for Wednesday four minutes later but moments of quality were few and far between.
Derby thought they were ahead in the 38th minute when Keiren Westwood could only parry a low Patrick Roberts shot but the flag went up when Kazim-Richards netted the rebound.
Wednesday scored in added time when a Paterson throw was met by Jordan Rhodes and, although Kelle Roos saved his header, Hutchinson forced in the rebound.
Derby had 45 minutes to save themselves and they turned the game on its head with two goals in the space of four minutes.
First Waghorn gave them hope in the 49th minute when he guided a header from a Tom Lawrence cross into the bottom right corner.
He was involved again three minutes later, holding the ball up before Roberts curled a shot from 20 yards past Westwood.
But Wednesday hit back in the 62nd minute when a mistake by Craig Forsyth allowed Paterson to level with a low shot and, seven minutes later, the game took another twist.
A corner to the back post was headed across by Dunkley and Borner turned it past Roos but Derby were back in it in the 78th minute.
Jozwiak was fouled by Dunkley as he raced clear and Waghorn fired the penalty into the top right corner for possibly the most important goal of his career.
Wednesday threw everything forward but Derby held on to secure their Championship status and condemn the Owls to League One.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1