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.
Full Time The referee blows for the end of the match.
Free kick awarded for a foul by Mark Little on Alan Lee. Direct free kick taken by Gary Naysmith.
90:00 +1:15 Substitution
Substitution David Ball on for Lee Tomlin.
Jack Hunt sends in a cross.
Lee Tomlin takes a shot from just inside the penalty box which clears the crossbar.
Chris Whelpdale is caught offside. Ian Bennett takes the free kick.
George Boyd decides to take a short corner.
84:32 Goal scored
Goal - Grant McCann - Huddersfld 0 - 3 Peterboro Grant McCann hits the back of the net with a goal direct from the free kick from outside the area to the top right corner of the goal. Huddersfield 0-3 Peterborough.
Substitution Chris Whelpdale comes on in place of Tommy Rowe.
Peter Clarke concedes a free kick for a foul on Craig Mackail-Smith.
Jordan Rhodes challenges Gabriel Zakuani unfairly and gives away a free kick. Direct free kick taken by Paul Jones.
Substitution Jordan Rhodes comes on in place of Benik Afobe.
Substitution Scott Arfield leaves the field to be replaced by Alan Lee.
Assist by George Boyd.
79:09 Goal scored
Goal - Craig Mackail-Smith - Huddersfld 0 - 2 Peterboro Craig Mackail-Smith finds the back of the net with a goal from the edge of the penalty box to the bottom right corner of the goal. Huddersfield 0-2 Peterborough.
Substitution Danny Cadamarteri is brought on as a substitute for Daniel Ward.
Assist on the goal came from Grant McCann.
77:42 Goal scored
Goal - Tommy Rowe - Huddersfld 0 - 1 Peterboro Tommy Rowe finds the back of the net with a headed goal from inside the six-yard box. Huddersfield 0-1 Peterborough.
George Boyd fouled by Gary Naysmith, the ref awards a free kick. The ball is swung over by Grant McCann,
Shot on goal comes in from Lee Tomlin from the free kick, blocked by Scott Arfield.
Booking The referee books Antony Kay for unsporting behaviour.
Craig Mackail-Smith fouled by Antony Kay, the ref awards a free kick.
Grant McCann takes a corner.
The referee penalises Benik Afobe for handball. Gabriel Zakuani restarts play with the free kick.
Mark Little fouled by Gary Roberts, the ref awards a free kick. Ryan Bennett restarts play with the free kick.
Scott Arfield is adjudged to have handled the ball. Paul Jones takes the free kick.
Foul by Scott Arfield on Grant McCann, free kick awarded. Direct free kick taken by Grant McCann. Scott Arfield fouled by George Boyd, the ref awards a free kick. Strike comes in from Gary Roberts from the free kick.
Corner taken left-footed by Gary Roberts, save by Paul Jones.
Ian Bennett takes the direct free kick.
Booking The referee shows Charlie Lee a yellow card.
Foul by Charlie Lee on Lee Peltier, free kick awarded.
Substitution Charlie Lee is brought on as a substitute for Grant Basey.
Substitution Charlie Lee joins the action as a substitute, replacing Grant Basey.
Shot from deep inside the area by Daniel Ward clears the crossbar.
Unfair challenge on James Wesolowski by Benik Afobe results in a free kick. Ryan Bennett restarts play with the free kick.
Gary Roberts gives away a free kick for an unfair challenge on Grant Basey. Paul Jones restarts play with the free kick.
Effort from outside the penalty box by Daniel Ward goes wide left of the target.
Gary Roberts challenges George Boyd unfairly and gives away a free kick. Grant McCann has an effort direct from the free kick.
The offside flag is raised against Benik Afobe. Indirect free kick taken by Paul Jones.
The second half has started.
45:00 +3:58 Half time
Half Time The match has reached half-time.
Close range effort by Craig Mackail-Smith goes wide of the right-hand upright.
Outswinging corner taken by Gary Roberts from the left by-line played to the near post, Close range effort by Benik Afobe goes wide of the right-hand upright.
Corner taken left-footed by Gary Roberts from the left by-line to the near post, Grant Basey makes a clearance.
Free kick awarded for a foul by George Boyd on Lee Peltier. Gary Roberts produces a shot on goal direct from the free kick, save by Paul Jones.
Free kick awarded for a foul by Tommy Rowe on Peter Clarke. Antony Kay restarts play with the free kick.
Foul by Tommy Rowe on Peter Clarke, free kick awarded. Antony Kay takes the free kick.
Free kick awarded for an unfair challenge on Scott Arfield by Grant McCann. Direct free kick taken by Ian Bennett.
Booking Jack Hunt booked for unsporting behaviour.
Direct free kick taken by Paul Jones.
Booking Lee Peltier is cautioned by the ref for unsporting behaviour.
James Wesolowski fouled by Lee Peltier, the ref awards a free kick.
Foul by Scott Arfield on Grant McCann, free kick awarded. Direct free kick taken by Grant McCann.
The offside flag is raised against Tommy Rowe. Peter Clarke takes the free kick.
Inswinging corner taken left-footed by Grant McCann from the right by-line, Peter Clarke makes a clearance.
Free kick awarded for an unfair challenge on Tommy Rowe by Daniel Ward. Paul Jones restarts play with the free kick.
Jack Hunt restarts play with the free kick.
Free kick awarded for an unfair challenge on Jack Hunt by Lee Tomlin.
Jack Hunt takes the direct free kick.
Booking Lee Tomlin is cautioned.
Lee Tomlin concedes a free kick for a foul on Jack Hunt.
The assistant referee signals for offside against Benik Afobe. Paul Jones takes the free kick.
Free kick awarded for a foul by James Wesolowski on Kevin Kilbane. Peter Clarke restarts play with the free kick.
Free kick awarded for an unfair challenge on Kevin Kilbane by James Wesolowski. Antony Kay takes the free kick.
Grant Basey concedes a free kick for a foul on Daniel Ward. Direct free kick taken by Jack Hunt.
Peter Clarke takes a shot. Save by Paul Jones.
George Boyd gives away a free kick for an unfair challenge on Lee Peltier. Free kick taken by Antony Kay.
Outswinging corner taken left-footed by Gary Roberts played to the near post, Headed effort from deep inside the penalty area by Lee Peltier misses to the left of the goal.
Gary Roberts takes a inswinging corner to the near post, clearance by Grant McCann.
George Boyd takes a shot. Save by Ian Bennett.
Kevin Kilbane concedes a free kick for a foul on Mark Little. Grant McCann delivers the ball from the free kick left-footed from right wing, Benik Afobe manages to make a clearance.
Inswinging corner taken left-footed by Grant McCann from the right by-line, clearance by Gary Naysmith.
Shot by Craig Mackail-Smith from deep inside the penalty area hits the post.
The referee gets the game underway.
Live text and data provided by The Press Association
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.