Goals either side of half-time from Ciaron Harkin and Jamie McGonigle saw Derry City come from behind against Dundalk at Oriel Park to give themselves a chance of European football next season.
Ruaidhrí Higgins' side were very much second best in the opening half and could have little complaints about falling behind to Sean Murray’s strike on 33 minutes.
However, a deflected equaliser on the stroke of half-time from Harkin brought about a major improvement on the restart with McGonigle pouncing for his fourth goal in his last three matches to clinch a first win for Derry at Oriel Park in 14 attempts - a run stretching back over eight years to April 2013.
The Candystripes must still hope that St Patrick’s Athletic beat Bohemians in the FAI Cup final on Sunday week to ensure they’re competing in the Europa Conference League next season but their fourth placed finish is nevertheless impressive given they were bottom when Higgins took charge in April.
For Dundalk, a rollercoaster season is at an end but the pre-match banner of 'Good Times Are Back In Sight’ summed up the general mood on the night as fans toasted their first game back under local ownership following the recent transfer of the club from PEAK6 to former owner Andy Connolly and the STATSports duo of Alan Clarke and Sean O’Connor.
Michael Duffy, who will re-join Derry next season alongside the injured Patrick McEleney, was an unused sub on the night by Vinny Perth and doubts still remain over how many of this Dundalk side have played their last game at the club.
Nevertheless, things are looking up at Oriel, even if their season ends on a downer.
The Lilywhites bossed the first half proceedings and could well have taken the lead after just five minutes when they had three chances in quick succession.
After David McMillan's effort from a Raivis Jurkovskis cross was charged down, it broke to Patrick Hoban whose effort was blocked by Cameron McJannett before Murray rifled the follow up over.
The home side could then have had a penalty on 10 minutes when Sami Ben Amar went down in the box under a challenge from Ciaran Coll but referee Neil Doyle was disinterested in their protests.
Dundalk had another big chance two minutes later when a superb ball by Murray looked to have put Hoban through but he was caught out in trying to outfox Nathan Gartside as Darren Cole got back to make a magnificent challenge to clear the danger.
McMillan then had another good chance on 14 minutes when Darragh Leahy’s cross from the left found him on the edge of the six yard box only for his flick on to creep agonisingly wide of the far post.
Gartside was then called into action once again on the half hour mark when he was forced to push a Murray free kick over the bar.
The breakthrough would arrive on 33 minutes. Murray skipped away from a challenge from Harkin before holding off Cole to blast to the net from 25 yards out for his 16th goal in Dundalk colours.
The Louth men could have doubled their lead three minutes later when Jurkovskis cut in from the right onto his left shot but his effort came off the head of McJannett before flashing just wide of the post.
Derry’s first attempt didn’t arrive until the 39th minute when a snap shot from McGonigle was pushed clear by Cherrie.
The Candystripes would level matters on the stroke of half-time, however, as a 35 yard effort from Harkin skimmed off the head of Andy Boyle to deceive Cherrie and creep in to the bottom left hand corner.
Indeed, the visitors could have been ahead at the break with McGonigle breaking in from the left in stoppage time only to be denied by Cherrie at a tight angle.
They then went close again three minutes after the restart when Will Fitzgerald cut in from the right before shooting through the legs of Leahy but Cherrie did well to make the save.
The pressure finally told on 52 minutes when McGonigle steered a shot past Cherrie to the bottom left hand corner after being slipped through by Fitzgerald, whose initial effort was blocked.
Harkin then kept his side ahead with a brilliant block on the line on 63 minutes to keep out Murray’s effort after good work by Sam Stanton on the left.
McGonigle had another half chance on 74 minutes but fired straight at Cherrie before Murray screwed another attempted drive from distance well wide moments later at the other end.
After further Dundalk penalty appeals fell on deaf ears with Daniel Cleary appearing to be held as he rose to meet a corner, Hoban then headed over from the follow up cross from Leahy.
Cleary then drilled just wide himself with an effort from about 40 yards out. Hoban then had a couple of half chances late on but Derry held out for what could be a hugely important win, worth at least €250,000.
Dundalk: Peter Cherrie; Raivis Jurkovskis, Daniel Cleary, Andy Boyle, Darragh Leahy; Sami Ben Amar (Daniel Kelly 53), Cameron Dummigan (Mayowa Animasahun 90), Sam Stanton, Sean Murray (Mark Hanratty 90); David McMillan (Ryan O’Kane 68), Patrick Hoban.
Derry City: Nathan Gartside; Ronan Boyce, Darren Cole, Cameron McJannett, Ciaran Coll; Ciaron Harkin, Joe Thomson, Danny Lafferty; Will Fitzgerald (Jack Malone 81), Jamie McGonigle (Bastien Hery 88), James Akintunde.
Referee: Neil Doyle (Dublin)