Cillian O'Connor hit 1-5 as Mayo saw off 14-man Donegal in the closing stages in Castlebar to ensure their Division 1 status.
Stephen Rochord's side went into this afternoon's game at MacHale Park, where a bumper crowd of 14,102 turned out, needing a win to stay safe and they looked far from doing so at half-time, trailing by three to a pumped up Tir Chonaill outfit which had bounced back from an early O'Connor penalty.
The visitors fell flat in the second-half however, only managing two points and losing substitute Eamonn Doherty to a red card in the closing quarter and from there O'Connor kicked the Westerners to victory.
Donegal had started six U21 players, including Eoghan Ban Gallagher who registered their first score of the afternoon with Cian Mulligan backing it up on two minutes.
Within the same amount of time the ball would be in the visitors' net after Mayo were awarded a penalty for a foul by 'keeper Mark Anthony McGinely on O'Connor and the latter tucked it away with expertise.
O'Connor, Moran and Dan Kirby all landed points afterwards to open up the gap but the visitors kicked into life again as Michael Murphy and midfielder Ciaran Thompson narrowed the difference down to two.
With the strong breeze at their backs, the home side hit back via Shane McNally but the second quarter was all Donegal for the most part and Murphy (free), Thompson and Jamie Brennan provided the scores to draw them level.
Marty O'Reilly gave Rory Gallagher's side back the lead and Murphy backed up a well-struck '45' with a free that had his side three to the good prior to Frank McGlynn erasing Colm Boyle's effort in injury-time, which made it 0-11 to 1-5 at the half.
Rochford sent on Diarmuid O'Connor and Stephen Coen to bolster the Connacht men's attack in the second-half, while Aidan O'Shea's introduction in the 46th minute would also prove significant in the win.
Lee Keegan had an early goal chance in the resumption saved well by McGinley and the rebound flew over the bar, as back-to-back Mulligan points followed at the other end to have Donegal seemingly in control.
Incredibly though, the leaders wouldn't score again and, obviously, that suited Mayo to take the points from them but not before a bust up in the 53rd minute which saw yellow cards dished out to Donegal's Jason McGee, Thompson and Murphy, along with Mayo's O'Shea.
When the dust settled Keith Higgins smashed over a point for the home side and moments later Donegal would be reduced to 14 when Doherty was issued a straight red card for kicking out at O'Shea.
It saw things go from bad to worse for Gallagher's charges and in the closing 12 minutes O'Connor flew over four points to double his return and assure Mayo's safety in the top tier.
Mayo - D Clarke; C Barrett, K Higgins (0-1), B Harrison; C Boyle (0-1), L Keegan (0-2), P Durcan; T Parsons, D Kirby (0-1); F Boland, S Nally (0-1), D Drake; K McLoughlin, A Moran (0-1), C O'Connor (1-5, 1-0pen, 0-4f). Subs: D O'Connor for F Boland, S Coen for C Boyle, A O'Shea for D Kirby, J Doherty for A Moran, D Vaughan for D Drake.
Donegal - M A McGinley; P McGrath, N McGee, K Lacey; E Ban Gallagher (0-1), E Doherty, M O'Reilly (0-1); J McGee, M Murphy (0-4, 3f, 1'45); C Mulligan (0-3), M Carroll, C Thompson (0-2); J Brennan (0-1), H McFadden, F McGlynn (0-1). Subs: E McHugh for H McFadden, P McBrearty for K Lacey, M McHugh for F McGlynn, M McElhinney for P McGrath, M Langan for N McGee.
Referee - C Reilly.