Watch: Kevin McLoughlin kicks magical score on his weaker foot to keep Mayo in Division One at Donegal's expense
Donegal 0-13 Mayo 0-13 (Donegal relegated)
Just as he had done in Omagh last year when he kicked a winner to preserve Mayo's long record of Allianz Division One football, Kevin McLoughlin's equaliser in Ballybofey at the death has ensured that Mayo will play in the top-flight for a 22nd consecutive year.
In a gripping finale to this relegation cliff-hanger, Mayo scored the last three points as their survival instincts kicked in once again.
It looked bad for them when Odhran MacNiallais pointed to put the home side three points clear in the 63rd minute and with numbers back to provide solid Donegal defence, Mayo appeared to be running out of road and ideas.
But Aidan O'Shea broke through to win a free which the impressive Conor Loftus converted before Eoin O'Donoghue landed a point from distance to create the platform for McLoughlin's late strike with just 20 seconds of the added four minutes left.
Donegal had a chance to seal it just before that but Patrick McBrearty, a late call-up after missing the previous two games, dropped a shot short and Mayo built from that to equalise.
Donegal are now unbeaten in 20 games in Ballybofey dating back to 2010 but that will have a hollow feel to it this evening.
They were 0-5 to 0-1 behind after 10 minutes, a deficit that may have been greater but for goalkeeper Shaun Patton's fine save from Diarmuid O'Connor.
Andy Moran scored three early points for Mayo but Donegal got to grips with them and=, driven on by Michael Murphy, they reeled off the next seven scores to lead by 0-8 to 0-5 by the 25th minute.
Eoghan Ban Gallagher got forward for two points while McBrearty kicked some outrageous scored with wind assistance.
By the break, it was 0-9 to 0-6 and Donegal were able to keep their heads in front for most of that second half.
Loftus kept chipping over the frees for Mayo but they appeared to be drifting before that late surge, their pride in that Division One status really telling.
Donegal can take a lot from the game however with Gallagher, Murphy and Jamie Brennan all showing good form before a crowd of 11,250.
Scorers - Donegal P McBrearty 0-4 (2fs), EB Gallagher, J Brennan, M Murphy )1f) all 0-2 each, O MacNiallais, C Thompson, F McGlynn all 0-1 each.
Mayo: C Loftus 0-6 (5fs), A Moran 0-3, K McLoughlin 0-2, E O'Donoghue, J Doherty 0-1 each.
DONEGAL: S Patton; N McGee, P McGrath, EB Gallagher; E Doherty, F McGlynn; L McLoone; M Murphy, H McFadden; C Thompson, O McMacNiallais, P Brennan; J Brennan, P McBrearty, N O’Donnell.
Subs: M McHugh for O’Donnell (46 mins), C Morrison for P McGrath (59 mins), S McBrearty for Thompson (59 mins), C Ward for McGee (61 mins), C Mulligan for J Brennan (67 mins),
Mayo: D Clarke; E O'Donoghue, C Crowe, P Durcan; C Boyle, S Coen, K McLoughlin; T Parsons, S O'Shea; D Drake, A O'Shea, D O'Connor; J Doherty, A Moran, C Loftus.
Subs: M Hall for Drake (63 mins), F Boland for S O’Shea (65 mins), B Moran for Parsons (67 mins), 22 A Freeman for Doherty (69 mins).