On-the-whistle report: Rotherham United 2 Sheffield Wednesday 2
They were set to climb out of the Championship's bottom three as goals from Jon Taylor and Richie Towell saw them lead in the tenth minute of added time at sold-out AESSEAL New York Stadium.
But substitute Dominic Iorfa finished off a goalmouth scramble and there was just time for referee Darren England to send off Fernando Forestieri for a second yellow card for jumping into the crowd to celebrate before he blew the final whistle.
It would have been the first time the Millers had beaten their neighbours from S6 in a home league clash since 1976.
They revelled in the New York sun and fully deserved to be in front against Steve Bruce's men.
Iorfa's late strike was a hammer-blow for a side fighting for their second-tier survival.
In a pulsating first half, Wednesday drew first blood as Fernando Forestieri despatched Adam Reach's cut-back from the right in the 35th minute.
But Rotherham were level just a minute later when Taylor buried his volley from Michael Smith's cross.
The Millers should have been in front before the half-hour mark, Anthony Forde unable to beat Keiren Westwood in a 24th-minute one on one after a slip by Michael Hector.
Then Smith side-footed wide seconds later from a golden position following Michael Ihiekwe's square ball.
Joe Mattock should have done better against his former club than blaze a 31st-minute shot over the bar and the left-back was a relieved man two minutes later when his weak header back to Marek Rodak saw Adam Reach nip in only to be denied by the post.
After the break, substitute Steven Fletcher flashed a header wide for the visitors before Wil Vaulks broke the length off the field and played in Towell who took too long to get his shot away.
The Millers were close to taking the lead in the 69th minute when Semi Ajayi powered in a header from a corner and Reach cleared off the line, with Wednesday managing to avert foil further Rotherham attempts in the frantic scramble that ensued.
Five minutes later they were in front as sub Joe Newell played in the ball from the left, the Owls failed to clear and Towell drilled in a shot off the post in front of an ecstatic kop.
Smith had a chance to end the contest in the 81st minute but headed sub Ryan Williams' cross just wide.
Then came the misery as Iorfa struck with virtually the last kick of the game.
Rotherham (4-1-4-1): Marek Rodak; Billy Jones, Michael Ihiekwe, Clark Robertson, Joe Mattock; Semi Ajayi; Jon Taylor, Will Vaulks, Richie Towell, Anthony Forde; Michael Smith. Not used: Lewis Price, Richard Wood, Matt Crooks, Ben Wiles, Jerry Yates.
Subs: Joe Newell (for Forde, 63), Ryan Williams (for Taylor, 78).
Wednesday (4-4-2): Keiren Westwood; Liam Palmer, Michael Hector, Jordan Thorniley, Morgan Fox; Adam Reach, Sam Hutchinson, Barry Bannan, George Boyd; Lucas Joao, Fernando Forestieri. Not used: Cameron Dawson, Joey Pelupessy, Atdhe Nuhiu, Achraf Lazaar.
Subs: Steven Fletcher (for Joao, 58), Roland Aarons (for Boyd, 75), Dominic Iorfa (for Thorniley, 90).
Goals: Taylor 36, Towell 74 (Rotherham); Forestieri 35, Iorfa 90+10 (Wednesday).
Referee: Darren England (Barnsley).
Attendance: 11,736 (2,625).