Bray Wanderers pulled off a dramatic turnaround to snatch all three points at Richmond Park.
A horror moment for Bray's Derek Prendergast saw him turn the ball into his own net from Daryl Kavanagh's free kick on 23 minutes to put Pat's ahead. Evan McMillan made it 2-0 with a header after 48.
But a late rally saw a double from debutante Conor Murphy and Joe Kendrick's late free kick, which took a deflection off the Pat's wall, to seal Bray's first win at the Inchicore venue since December 2002.
The Seasiders had an excellent start to the game and both Dean Zambra, on seven minutes, and John Mulroy (16) had shots on the Pat's goal but the home goalkeeper Gary Rogers saved both efforts.
John Mulroy then sent a header inches over the bar on 18 minutes as Bray continued their excellent early work but Pat's began to improve and went ahead in bizarre circumstances on 23 minutes, thanks to Prendergast's horrendous error.
Kavanagh floated a dangerous looking free kick into the visitors' penalty area which was met by the Bray man but in his attempt to clear the danger he diverted the ball past Gregg.
Ian Daly nearly put the home side further ahead on 26 minutes, but his fierce shot from the left of the area was well saved by Gregg.
Pete Mahon's side began to stamp their mark on the game from then on but had to wait for the third minute of the second half to increase their lead.
Kavanagh was involved again and it was his corner that Evan McMillan connected with to power a tremendous header past Gregg.
Bray pulled a goal back on 70 minutes thanks to a low close-range finish from substitute Murphy. Making his first appearance for the club, Murphy then levelled things up when he headed in Shane O'Neill's cross on 75 minutes.
Kendrick completed the dramatic turnaround with a free kick that took a deflection off the Pat's wall as it swept past Rogers on 82 minutes.
© RTÉ Sport