Gerard Doherty saved a 95th-minute penalty to ensure that Derry City booked their place in the FAI Cup quarter-finals after an incredible finale at the Brandywell.
With City leading through Aidy Delap's first senior goal, St Pat's were awarded a spot-kick after Dan Seaborne fouled Simon Madden, but Doherty saved from Ian Turner to keep City's Cup hopes alive.
Derry should have taken the lead on 37 minutes when a burst forward by Jamie McDonagh left Pat's short on numbers at the back and he cut inside before sending Aaron McEneff through on goal.
McEneff was on his unflavoured left foot and it showed as he shot straight at Clarke. The goalkeeper had to be alert within seconds as Rory Hale tried his luck, forcing him to tip the ball over the crossbar with an effort from the edge of the area.
Derry had a real chance to break the deadlock on 55 minutes when McEneff's corner was met by Seaborne, who headed the ball back across goal, sending Madden into a tailspin with the ball bouncing against his elbow.
Penalty appeals were dismissed by referee Neil Doyle and play continued but Darren Cole was unable to turn the loose ball in from close range.
The deadlock in this tense cup tie was finally broken with just ten minutes remaining and it was a bizarre goal.
Aaron Splaine burst through two challenges in the centre of midfield and raced forward before attempting to play Delap through on goal. The youngster was wiped out in the area but, with the whole Brandywell roaring for a penalty, the ball somehow went past Clarke and into the net.
Then came the late drama with Turner sending his effort down the middle but Doherty leaving a trailing leg, which proved to be the very final act of this absorbing cup tie.