Mayo scored an extra-time qualifer win over Derry, finally settling a thriller by 2-21 to 1-13 in Castlebar.

Five Niall Loughlin scores helped Derry to a 0-08 to 0-07 interval lead, with Cillian O’Connor converting five Mayo frees.

Mayo went in front in the dying moments with a Conor Loftus goal, but Mark Lynch punched home a Derry goal to tie it up at 1-12 each.

In extra-time, Mayo went ahead with a Jason Doherty goal, and David Clarke saved a James Kielt penalty as they turned around with a 2-17 to 1-13 advantage

And they finished a tiring Derry side off with scores from Doherty and O’Connor.

In front of a crowd of 11,465, Aidan O’Shea came in as a pre-match replacement for his first start in league or championship this year, and won the free that Cillian O’Connor fired over from 45 metres for an early lead.

Playing with just two men up front in Danny Heavron and Danny Tallon, the Oak Leafers defended deep and relied on pace and mobility to break the lines.

And they looked capable of exploiting gaps in the westerners’ defence when Niall Loughlin sent over a superb point to cancel out Andy Moran’s effort, and with ten minutes played the sides were level.

And the Ulster men went in front for the first time in the 16th minute when Benny Heron powered through the middle to fire over an inspiring score.

If Mayo’s security at the back was being called into question, their finishing was equally troubling to the home support as they registered a sixth wide, while at the other end, Ryan Bell stretched Derry’s lead.

The Connacht men did have a goal chance when goalkeeper Ben McKinless deflected an Andy Moran effort onto a post, and saved on the rebound from O’Connor.

O’Connor’s free-taking was keeping Mayo in it, his third narrowing the gap in the 23rd minute, before Lee Keegan got forward to equalise with a fisted effort.

Derry also had a goal chance, but Carlus McWilliams saw his shot parried by ‘keeper David Clarke, before the ball skidded off a defender and on to a post.

Late in the half, Loughlin steered over two more frees to send Derry into the break with a narrow 0-08 to 0-07 advantage, but they faced the second half without midfielder Conor McAtamney, a black card dismissal in stoppage time.

McWilliams stretched the advantage, but the sides were soon level for the sixth time, O’Connor on target again.

And the Ballintubber star had another goal chance when he connected with brother Diarmuid’s enticing, dropping delivery, but couldn’t direct his shot on target.

Remarkably, a third opportunity fell to O’Connor, but this time he was denied by a superb McKinless save, after Moran had seen a brilliant effort come back off a post.

The Derry keeper as fast becoming his side’s heroic figure, as he pulled off another blinding save, this time from Kevin McLaughlin, after O’Connor had provided the defence-splitting pass

James Kielt came off the bench to drill over a free, restoring Derry’s two points cushion, but the pressure was building as Mayo pressed in search of redemption.

And they got the goal they so desperately needed when O’Connor sent substitute Conor Loftus in to smash the ball to the roof or the net.

When the same player added a point, it looked as if they had turned it around, but less than two minutes later, as the game slipped into stoppage time, Carlus McWilliams floated in a delivery for Derry sub Mark Lynch to punch to the net.

It was 1-12 to 1-12 at the end of 70-plus minutes of absorbing action, and more drama was to follow in extra-time.

Substitute Jason Doherty banged in a second Mayo goal, and then it was the turn of their goalkeeper David Clarke to make himself a hero with a penalty save from Kielt.

Despite the loss of Patrick Durcan to a straight red card, they turned around with a seven points advantage, 2-17 to 1-13, O’Connor having brought his tally to ten points, including a first from play.

And they pushed the gap out to 11 points with points from O’Connor, who finished with 12, Doherty and Diarmuid O’Connor.

Mayo: D Clarke; B Harrison; G Cafferkey, C Barrett; C Boyle, L Keegan (0-01), P Durcan (0-01); D Vaughan, T Parsons; F Boland, A O’Shea (0-01), S Coen; K McLoughlin (0-01), C O’Connor (0-12, 9f, 1 ’45), A Moran (0-02).

Subs: D O’Connor (0-01) for Boland (h-t), S O’Shea for Vaughan (54), J Doherty (1-01) for Coen (54), C Loftus (1-01) for Moran (56), D Drake for Harrison (63), C Crowe for Barrett (81), S Nally for Keegan (84), D Kirby for McLoughlin (87)

Derry: B McKinless; N Keenan, B Rogers, K McKaigue; M McEvoy, C McFaul, C McWilliams (0-01); C McKaigue, C McAtamney, D Heavron (0-01); R Bell (0-02), N Loughlin (0-06, 5f), E Lynn; D Tallon, D Heavron, B Heron (0-01).

Subs: E McGuckin for McAtamney (BC 35), M Lynch (1-01) for Tallon (46), J Kielt (0-01, f) for Bell (56), S McGuigan for Lynn (67), C Nevin for McEvoy (75), N Forrester for McFaul (75), G O’Neill for Loughlin (84), C Doherty for Heron (86)

Referee: M Deegan (Laois).