St Patrick's Athletic climbed out of the SSE Airtricity League Premier Division relegation zone with a richly deserved 2-1 win over Derry City at Richmond Park.
Liam Buckley's side had to do it the hard way after trailing at half-time to Ronan Curtis' goal against the run of play, but a Kurtis Byrne penalty and Graham Kelly's strike sealed a thrilling turnaround.
The Candystripes came to Inchicore third in the league on the back of a 4-0 thumping of Sligo Rovers but they were second-best all over the pitch on a calm night by the Camac.
The visitors did fashion the game's first chance within two minutes as Barry McNamee clipped a nine iron over the top of the defence for Lukas Schubert but the Austrian couldn't force the ball home.
Three minutes later, Kurtis Byrne â€“ playing in his best position behind striker Christy Fagan â€“ had the crowd on their feet with a rasping volley that dipped mere inches over the crossbar.
Graham Kelly should have headed Pats into the lead after Fagan had done brilliantly to dive and flick on Ian Bermingham's cross, but he nodded it straight into the arms of Candystripes keeper Ger Doherty.
Derry were seeing little of the ball but looked dangerous on the counter-attack throughout, and McNamee gave warning of this as he stole in behind the Pats defence and nicked the ball just wide of the post.
Another quick counter saw Ger Doherty pick out Curtis with a quick throw and the striker left Michael Barker for dead before shooting from the edge of the box but Jordi Balk was able to block.
Fagan then had a glorious chance to give the Saints the lead as he peeled off the centre halves and was picked out by Kurtis Byrne, but surprisingly rippled the wrong side of the netting with his drilled shot.
Derry had their best spell of the half in the closing minutes and Pats were grateful to Conor O'Malley for pulling off an outstanding save to push Harry Monaghan's top corner-bound shot onto the bar.
It was to count for little, however, as from the resulting corner Curtis found himself unmarked deep in the box and looped a header back across goal and over the head of Killian Brennan on the post.
The Saints lost Killian Brennan to a thigh injury early in the second half but the home side continued to enjoy the better of the play.
They should have equalised just after the hour as Kurtis Byrne beat two tackles in the box before Fagan turned the ball on goal, and Darren Cole almost put it into this own net as he cleared.
They did draw level shortly after as referee Rob Rogers awarded a penalty for a foul during the delivery of a corner, and Kurtis Byrne stepped up to send the ball nestling in the top corner.
It was no less than Pat's deserved, having been the better team for most of the game, and they continued to press for a winner.
It came 13 minutes from time as a wonderfully flighted diagonal ball over the top from Rory Feely was taken in stride by Conan Byrne and he beat McNamee before pulling the ball back to the penalty spot for the arriving Kelly to send the home fans into hysterics.