Two late goals from Jason Sherlock robbed Longford of what would have been their first O'Byrne Cup title since 2000 as Dublin claimed a 2-12 to 1-14 victory in tonight's final at Parnell Park.
The Dubs trailed by 1-13 to 0-12 heading towards injury-time but with Bernard Brogan's seventh point of the night being followed by Sherlock's brace, they dramatically retained the cup.
The veteran poked home a 70th-minute goal and he produced another quality finish, four minutes later, to break Longford hearts.
Brian Kavanagh's seventh-minute goal had helped Luke Dempsey's underdogs to a 1-06 to 0-07 interval lead.
Kavanagh was all over the Dublin defence in the opening stages. He won possession out on the right wing and floated over the game's opening point after only 15 seconds of play.
The St Patrick's College student set up Francis McGee for another Longford point before notching the third, when he outdid David Henry and bisected the posts with ease.
A McGee free extended Longford's lead to 0-04 to 0-00 before Dublin awoke from their slumber thanks to a point from new wing-forward Brendan McManamon.
Three minutes later, the defending champions were further behind. Again Henry was badly caught out by Kavanagh as he ghosted through on goal. The Longford hitman's first shot was saved by John Leonard but he rammed home the rebound for a 1-04 to 0-01 lead.
After Declan Farrell and Bernard Brogan had swapped points, it was clear that Dublin's performance was annoying their manager Paul Caffrey who looked a disgruntled figure on the touchline.
But ill-discipline was beginning to creep into Longford's game and Brogan was the man to punish them. Another point from the Plunkett's youngster and a left-sided effort from Kevin Bonner cut the gap further for Caffrey's charges.
Points from John O'Brien and Brogan (free), with Longford's Kavanagh, Kevin Mulligan and McGee scoring at the other end, brought the first half's scoring to a close.
The flurry of points continued on the restart with O'Brien floating over a free for Dublin before Brogan and McGee traded frees and O'Brien added another before Farrell doubled his tally for the evening.
Still, the quality of the game dipped in the second half as both sides tired and wides began to blight the game. Dublin missed out on a goal when Brogan's shot was saved well by Longford goalkeeper Damien Shierdan.
Brogan continued to be Dublin's main threat and his dribble forward would have led to a goal but for some last-ditch defending from Longford.
Scores from Paddy Dowd and both of the Bardens, Paul and David, looked to have copper-fastened the win for Dempsey's men but Dublin came with a dramatic late burst.
McManamon made a thrust forward and a pass over to the back post when substitute Sherlock was on hand to fire home to the net.
It looked like the 1995 All-Ireland hero was in the square when the pass was made but the goal stood and Dublin were back in contention, albeit in the dying embers of the match.
A Kavanagh point, his fourth of the final, steadied Longford but there was still time for Eamonn Fennell to find the unmarked Sherlock with a lobbed pass and he made no mistake with a bullet finish to the right corner to ruin Longford's night.