Kevin McLoughlin thumped over a brilliant point in the fourth minute of injury time to preserve Mayo's Division One status as it finished 0-13 each at Ballybofey.
In this Round Seven clash, which was effectively a relegation shoot-out, the hosts looked home and hosed when leading by three points after 65 minutes but Mayo - as their wont - wriggled off the hook with unanswered scores from Conor Loftus (free), Eoin O'Donoghue and McLoughlin. Donegal had to win to beat the drop, while the draw was enough for the visitors.
After ten points were shared inside the opening twenty minutes, the hosts kicked on with three scores from the returning Patrick McBrearty and another from Eoghan Ban Gallagher to take a 0-9 to 0-6 lead into the interval.
Andy Moran and Frank McGlynn shared the first two points before Mayo surged four ahead thanks to Jason Doherty, McLoughlin and Moran (2). But back came Declan Bonner's men with seven unanswered points from Ciaran Thompson, Gallagher (2), Michael Murphy, Jamie Brennan and McBrearty (2) to assume a 0-8 to 0-5 advantage with nine minutes left before the break.
Loftus posted two frees either side of a Murphy reply upon the restart and Loftus' brace following a McBrearty effort had the gap back to the minimum with 47 minutes gone, 0-11 to 0-10.
Hugh McFadden and Odhrain MacNialllais teased the gap out to three but Loftus struck back from a free five minutes from time to set up a nervy finale. In added time, O'Donoghue and McLoughlin - off his right boot! - stepped forward with two more crucial points as the Connacht county claimed the precious point that secures their top-flight survival.
Donegal - S Patton; P McGrath, N McGee, E Doherty; P Brennan, L McLoone, E Ban Gallagher (0-2); C Thompson (0-1), H McFadden; F McGlynn (0-1), M Murphy (0-2, 1f), O MacNiallais (0-1); N O'Donnell, P McBrearty (0-4, 2f), J Brennan (0-2). Subs: M McHugh for N O'Donnell, S McBrearty for C Thompson, C Morrison for P McGrath, C Ward for N McGee, C Mulligan for J Brennan.
Mayo - D Clarke; C Crowe, D Drake, E O'Donoghue (0-1); C Boyle, S Coen, P Durcan; S O'Shea, T Parsons; K McLoughlin (0-2), A O'Shea, D O'Connor; J Doherty (0-1), A Moran (0-3), C Loftus (0-6, 4f). Subs: M Hall for D Drake, F Boland for S O'Shea, B Moran for T Parsons, A Freeman for J Doherty.
Referee - A Nolan.