Rotherham and Wednesday played out a dramatic derby encounter that ended with four goals in seven minutes to seal an incredible win for the Owls.
Ben Pringle struck what looked set to be the only goal of the game in a second half the hosts edged, albeit with the aid of a deflection.
But an already exciting contest exploded into life at the death and the Owls emerged triumphant.
Wednesday equalised with four minutes to go through Caolan Lavery – only for Millers substitute Jordan Bowery to score with his first touch just 30 seconds later to swing the pendulum back in the Millers’ favour.
Then, Atdhe Nuhiu headed home to grab what seemed would be a point before, amazingly, Kieran Lee slotted a winner in added time.
There were two talking points before a ball was even kicked at The New York Stadium as the Owls lost Kamil Zayatte to a hamstring injury in the warm-up before the start was delayed due to a pyrotechnic incident in the home area.
And there was almost a third just four minutes in when Claude Dielna had his pocket picked 25 yards out and Matt Derbyshire advanced on goal but Keiren Westwood stood tall to parry clear.
Wednesday found their rhythm, though, and Lewis McGugan brought a fine save from ex-SWFC loanee Damian Martinez, who dived low to save and make an instant impression for his new temporary employers.
The hosts then had the ball in the net midway through the first half as Westwood deflected into his own goal under pressure but play was pulled back for an infringement.
Wednesday powered upfield in an instant and after McGugan fed Joe Mattock with a sublime pass, the ball was centred low for Lee, whose shot was blocked on the line by Danny Lafferty.
A topsy-turvy opening 45 saw play go straight to the other end, where Westwood spectacularly diverted a Derbyshire header from a Pringle corner.
The second half showed no signs of letting up, with the Millers out of the traps the quickest.
Wednesday struggled to get out of their own half and went one down on 57 minutes.
Pringle drove a low shot on goal but the ball took a wicked deflection off Tom Lees that wrong-footed Westwood, who was powerless to keep it out.
The strike gave Rotherham a visible boost and Jack Hunt went close just past the hour after embarking on a mazy run that ended with a vicious effort that whistled over.
Wednesday did threaten on the counter and substitute Stevie May drilled hard but wide ten minutes from the end.
Rotherham defended deep in the closing stages, inviting Wednesday pressure, and the visitors duly took advantage to set up the grandstand finish.
McGugan did well down the right and delivered an accurate ball into the mix for substitute Lavery to nod home, but with Wednesday fans still celebrating, Millers substitute Bowery went one better and drilled into the net from close range to put the hosts back in charge.
With the game heading into stoppage time, McGugan this time found the head of Nuhiu from a free kick to haul the Owls level for the second time and then right at the death, Lee took a clever feed from May into his stride before calmly side-footing in the winner.
Rotherham: Martinez, Lafferty, Broadfoot, Frecklington, Pringle, Morgan, Sammon (Bowery 84), Wilson, Derbyshire (Milsom 89), Hunt, Smallwood
Owls: Westwood, Hutchinson (Maguire 75), Nuhiu, Lees, Helan (May 73), Mattock, Lee, Isgrove (Lavery 58), Dielna, Vermijl, McGugan