Fourteen-man Derry produced a heroic display to win their Football League Division One semi-final against Mayo.
Caolan O'Boyle scored a 13th-minute goal, but Andy Moran found the net for Mayo and then Fergal Doherty was sent-off for a second yellow card offence.
Derry led 1-8 to 1-7 at half-time but fell behind before a 51st-minute goal from Kevin Johnston levelled the scores at 1-12 to 2-9 at Croke Park.
Mayo moved ahead but four consecutive late points helped Derry progress.
Points from Alan Freeman (2) and Aidan O'Shea gave the Connacht champions an early lead in a pulsating game, with Mark Lynch and Ciaran McFaul pointing for the Oak Leafers.
Emmett McGuckin, one of only two survivors from the side which lost to Mayo last weekend, then knocked the ball between the posts to equalise.
Keith Higgins nudged James Horan's outfit ahead, but O'Boyle's goal saw Derry establish a two-point advantage.
Freeman and Lynch traded points, before Moran shot home after 24 minutes to put his side one point ahead.
Derry's hopes looked to have been dealt a major blow when Doherty was red-carded for a late challenge in the build-up to the goal, having earlier received a yellow.
Lynch scored three further points before the interval, taking his first-half contribution to five, while Sean Leo McGoldrick also got his name on the scoresheet.
Lee Keegan and Mikey Sweeney registered scores for Mayo to ensure their deficit at the break was just one point.
Points from Freeman (2), Jason Doherty (2) and Jason Gibbons to a solitary O'Boyle point made the score 1-12 to 1-9 in Mayo's favour as they made their extra man count.
Thomas Mallon denied Mayo's Donal Vaughan a goal, then Derry found the net for the second time to restore parity.
McGoldrick orchestrated the goal, holding off challenges from two Mayo defenders, before teeing up Johnston, who fisted the ball into the net.
Freeman and Enda Varley recorded points, but two frees from the impressive Lynch brought the sides level once more.
Mallon again distinguished himself by saving a Keegan shot, Freeman landed his sixth point of the day, then substitute Karl McKaigue pointed for Brian McIver's battlers.
With two minutes remaining, Lynn turned at a tight angle and shot over the bar, then Lynch added a further two points to bring his personal tally to nine.
A late Moran point was a mere consolation as Derry secured a place in the Division One final for the first time since 2009.
They will face Dublin, who recovered from 10 points down to beat Cork 2-20 to 2-13.
Derry: T Mallon; O Duffy, C McKaigue, D McBride; K Johnston, G O'Kane, SL McGoldrick; F Doherty, Patsy Bradley; C McFaul, M Lynch, E Lynn; B Heron, E McGuckin, C O'Boyle. Subs: E McNicholl, C McAtamney, K McKaigue, C Kielt, A McAlynn, M Craig, N Holly, A Devlin, D Heavron, C McWilliams, C McGoldrick, A Kerrigan, D Mullan, J Kearney, E Bradley
Mayo: R Hennelly, S McHale, G Cafferkey, K Keane, L Keegan, D Vaughan, C Boyle, T Parsons, S O'Shea, K Higgins, A Moran, J Doherty, K McLoughlin, A Freeman , C O'Connor.