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.
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.