Two goals in the last three minutes of normal time saw Town turn three points into none at Highbury.
Uwe Rosler’s players looked set for victory when Cian Bolger fired them into an 82nd minute lead, following on from Amari’i Bell’s first-half opener.
However, an increasingly open game saw Peterborough battle back after Michael Doughty had scored their first equaliser early in the second half.
Jack Marriott hauled them level for a second time on 88 minutes before Danny Lloyd capitalised on Alex Cairns’ error to snatch a 90th minute winner.
It was a suitably breathless end to a match which took a while to warm up, yet ended with three further efforts hitting the bar - the last of those coming Town’s way in added time.
Both sides began slowly with misplaced passes aplenty thanks to an occasionally strong breeze.
The visitors were dealt an early blow with an ankle injury forcing off Gwion Edwards though his replacement, Lloyd, was to make the decisive impact.
He had one shot blocked and sent the rebound wide as Peterborough had the better of the few early chances that came along.
Nevertheless, it was Town who took the lead on 29 minutes after Devante Cole dispossessed Alex Penny before linking up with Bell and Aiden O’Neill.
That saw Cole get into the area where his cross was cleared by Ryan Tafazolli, only as far as Bell 18 yards out.
He showed calmness to beat his man before drilling a shot past Jonathan Bond and into his left-hand corner.
Cole fired wastefully off target and Bond held Kyle Dempsey’s low effort as the home side ended the first half on top.
That advantage was to only last 10 minutes of the second half when Marcus Maddison curled in a cross from the right-hand side and the unmarked Doughty headed past Cairns.
United were unlucky not to earn a penalty when Jordy Hiwula felled Lloyd inside the area but referee Anthony Backhouse waved play on, much to the visitors’ annoyance.
Dempsey shot narrowly wide and George Glendon wastefully sidefooted straight at Bond from 18 yards before a breathless final quarter-hour brought three goals - and possibly three more.
Maddison came within inches of scoring from 30 yards on 78 minutes, only to see his effort strike the top of Cairns’ crossbar.
Town celebrated that good fortune four minutes later when Bolger scored after Bond had kept out Nathan Pond’s header.
The crossbar denied Town a third on 87 minutes via Jack Sowerby’s free-kick; ill fortune which was doubled within seconds.
Maddison sent a wonderful long pass behind the home defence with Marriott controlling it expertly and beating Cairns.
If that was disappointing then, two minutes later, Town were floored as Cairns spilled Maddison’s long-range free-kick and Lloyd pounced.
Even then, there was still time for Cole to almost snatch a point, only to head against the frame of Bond’s goal.
Fleetwood Town: Cairns, Bolger, Pond (Hunter 90), Eastham, Coyle, Dempsey, O’Neill (Sowerby 62), Glendon, Burns (Hiwula 57), Cole. Subs not used: Neal, Maguire, Schwabl, Cargill.
Peterborough United: Bond, Penny, Taylor, Tafazolli (Miller 84), Hughes, Da Silva Lopes (Anderson 60), Grant, Doughty, Maddison, Marriott, Edwards (Lloyd 8). Subs not used: O’Malley, Baldwin, Forrester, Kanu.
Referee: Anthony Backhouse.