Mayo had to come from behind in the final quarter to prevent a shock defeat in a thrilling All-Ireland qualifier in the Thurles sunshine.

Mayo were facing a shock exit when they trailed by a goal going into the final quarter against a rampant Tipperary side.

But a fortuitous goal from James Durcan got Mayo back in the game and they took over, outscoring Tipp by 1-08 to 0-00 in the final quarter of the match to book their place in the third round.

Durcan’s goal tied the sides at 1-11 each after 52 minutes and Kevin McLoughlin them edged them in front shortly after to lead for the first time since the sixth minute.

Tipp’s challenge faded and they failed to score in the final quarter as Mayo pushed for home with eight unanswered points in a devastating finish.

Mayo, though, were clearly in trouble when they trailed by 1-07 to 0-08 at the interval, with Michael Quinlivan flicking home a super goal after ten minutes to wipe out Mayo’s early burst which yielded four points in the opening six minutes.

Tipperary were good value for their interval lead with Mayo suffering a double blow when Seamus O’Shea went off injured and Colm Boyle was black-carded on his 100th appearance for the county.

Tipp were superb after the restart and points from Quinlivan, Liam McGrath and Conor Sweeney looked set to fashion a shock victory but Mayo, with Jason Doherty superb, came storming back to book their place in the third round.

Doherty kicked two excellent efforts as Mayo took control throughout the field and surged forward at every opportunity.

Paddy Durcan burst through to put four between them before Andy Moran had a shot for a goal deflected over to lead by 1-16 to 1-11 after 60 minutes, while late points from Lee Keegan and Conor Loftus wrapped up the win as Mayo march on.

Mayo: David Clarke; Keith Higgins, Ger Cafferkey, Patrick Durcan (0-01); Chris Barrett, Colm Boyle, Stephen Coen; Seamus O’Shea (0-01), Lee Keegan (0-01); Kevin McLoughlin (0-03), Aidan O’Shea (0-01), James Durcan (1-02); Jason Doherty (0-03), Cillian O’Connor (c) (0-05, 5f), Andy Moran (0-01).

Subs used: Diarmuid O’Connor for S O’Shea (30), Cian Hanley for Boyle (41, bc), Evan Regan for McLoughlin (38-46), Eoin O’Donoghue for Barrett (56), Evan Regan for C O’Connor (68), Conor Loftus (0-01) for Moran (69), Danny Kirby for D O’Connor (72).

Tipperary: Evan Comerford; Shane O’Connell, John Meagher, Alan Campbell; Bill Maher, Robbie Kiely, Jimmy Feehan; Jack Kennedy (0-01), Steven O’Brien; Josh Keane, Brian Fox, Philip Austin (0-02); Conor Sweeney (0-02), Michael Quinlivan (1-02), Liam McGrath (0-04, 2f).

Subs used: Liam Boland for Austin (58), Liam Casey for Kennedy (60), Kevin O’Halloran for McGrath (64), Kevin Fahey for Feehan (65), Jason Lonergan for Keane (68), George Hannigan for O’Brien (72).

Referee: Maurice Deegan (Laois).