Peterborough hit three late goals to beat Huddersfield at Old Trafford and win promotion back to the Championship at the first time of asking.
The League One play-off final looked to be heading for extra time before Posh hit three goals in seven minutes.
Tommy Rowe headed them ahead from Grant McCann's free-kick before top scorer Craig Mackail-Smith's shot deflected in off Antony Kay's knee.
McCann curled in a free-kick to inflict Town's first league defeat of 2011.
For Huddersfield, who had not lost in 27 league and play-off games, the scoreline was wildly unfair.
But, for Posh boss Darren Ferguson, back on the ground where he started his own career, victory proved a happy end to a mixed weekend for his family, his father's Manchester United having lost to Barcelona in Saturday's Champions League final.
To add to Ferguson Jnr's sense of achievement, Posh have effectively swapped leagues with Preston North End, who sacked him in December.
Peterborough, who have now been promoted in all the three play-off campaigns they have participated in, were the better side in the first half.
They almost took the lead within five minutes, only for Mackail-Smith's shot to be deflected onto the outside of the post by a last-gasp tackle from Kay.
George Boyd then showed good trickery in forcing an Ian Bennett save from 30 yards out as Posh, relegated from the Championship a year ago, threatened to run riot.
Huddersfield looked like their chances would be more likely to come from set-pieces and crosses, and Lee Peltier headed over from Gary Roberts' ball.
Posh keeper Paul Jones then plucked Peter Clarke's goalbound header out of the air.
Huddersfield boss Lee Clark had decided to play Benik Afobe as his only out-and-out striker, his usual policy for away games.
But, when the on-loan Arsenal youngster received the ball in the box, he failed to control it and the chance was gone.
Mackail-Smith was then put through, denied by another brilliant last-ditch Kay tackle.
And, from another Terriers cross, Afobe took the ball off Daniel Ward's foot when he was ready to shoot from inside the box.
The game was going from end to end and Boyd put Mackail-Smith through, but he was denied by yet another fine saving tackle, denying him the chance to shoot.
Roberts saw his free-kick tipped wide by Jones and then his corner found Afobe, who turned in the box but fired wide from eight yards out.
And, with the final chance of the first half, Mackail-Smith fired wide unmarked in the box after Boyd poked him through.
In the first major incident of the second half, McCann hit a curling free-kick from 20 yards out just over.
Then came Huddersfield's big chance, Ward running down the right wing, cutting inside and smashing the ball against the bar.
The Terriers were growing in confidence, causing Posh plenty of problems from crosses. But they could have been down to 10 men, when Kay brought down the effervescent Mackail-Smith, who was through on goal.
He was saved by the fact that defensive partner Clarke was still in with a chance of catching him and was only shown a yellow card.
Posh's 48 league and play-off games this season had seen 189 goals and, until the 78th minute, it looked like this game would be letting that record down.
But after all Huddersfield's pressure, Posh broke the deadlock, Rowe's header finding the centre of the goal from McCann's whipped free-kick.
Clark decided to go to two up front and brought on Danny Cadamarteri. But the momentum was all Peterborough's by now, Mackail-Smith's shot hitting Kay before finding the corner of the net.
Mackail-Smith's strike, his 35th of the season and 99th for the club, is likely to be his last, the Scotland international having been targeted by Premier League-bound QPR and Norwich amongst others.
McCann, whose set-pieces had caused problems for the Terriers, then put an unreflective gloss on the scoreline from 25 yards out. And Lee Tomlin fired over late on from Boyd's pass as Posh threatened to add a fourth.
But the final whistle ended the heartbreak for Huddersfield, who, having finished third in the league, eight points clear of Posh, had been in the chase for automatic promotion until the penultimate day of the league campaign.