Centre-half Michael Leahy scored two goals and an own goal in extra-time for St Patrick's Athletic, but they still exited the EA Sports Cup against holders Dundalk in a penalty shootout after the game finished 4-4 at Richmond Park.
Dundalk led 2-0 at half-time thanks to goals from Marco Tagbajumi and Ronan Murray, but the Saints forced extra-time as Christy Fagan and Graham Kelly scored in the 58th and 60th minute respectively.
Leahy, who has yet to start a league game for the Saints, put his side into the lead on 97 minutes before diverting in Dylan Connolly's cross to make it 3-3.
But he made it a most unusual seven minutes with a header on 104 minutes for his second of the game to put Pat's through.
But the drama did not end there as Dane Massey brought the game to a penalty shootout in the 119th minute.
Darragh Markey struck his penalty over the crossbar at 7-7 and Tagbajumi slotted home to send the Lilywhites into the last eight.