Max Murphy netted his seventh penalty of the season and Danu Kinsella Bishop made it safe at the death as Bray Wanderers earned a valuable 2-0 home win over SSE Airtricity Men's First Division leaders Dundalk in sweltering heat at the Carlisle Grounds.
The left-back Murphy stroked the ball calmly past Enda Minogue following Seán Keogh's foul on Billy O’Neill - although the contact appeared to have occurred just outside the area.
And Kinsella Bishop applied the finishing touch with a composed finish in injury time as the Seagulls reduced the gap at the top to six points.
Dundalk dominated the game and had numerous chances to score before and after the opening goal but found themselves uncharacteristically wasteful in the decisive third.
Right-winger Eoin Kenny - the 19-year-old son of ex-Republic of Ireland and Dundalk boss Stephen - was a livewire in the first half and created numerous chances for himself and others.
He had two great chances just after the half hour as he weaved his way into the box and shot just wide before heading over moments later.
It was O’Neill who proved the gamebreaker, however, as he forced Keogh into a foul and referee Declan Toland pointed to the spot, Murphy sending Minogue the wrong way.
The Lilywhites had a succession of chances after the break but Corcoran was imperious between the sticks for the home side.
He touched a header from Dean Ebbe onto the post early on before Paul Murphy blocked Ireland international Daryl Horgan’s follow up.
Corcoran then stooped smartly to deny Martin McHale’s header from a corner, and the ex-Dundalk man again got low to turn Ebbe’s header wide.
Kenny, Andy Paraschiv and sub Declan McDaid were all wasteful as Dundalk turned the screw but could not find the vital finish.
And Kinsella Bishop made them pay in the fourth minute of injury time as he rounded Minogue and slotted home from a wide angle.
Bray Wanderers: Jimmy Corcoran; Jamie Duggan, Killian Cantwell, Paul Murphy; Max Murphy; Rhys Bartley (Jordan Tallon 90+5), Cian Doyle (Benjamin Fagbemi 85), Conor Knight, Rhys Knight (Guillermo Almirall 72)t, Billy O'Neill; Cian Curtis (Danu Kinsella Bishop 72).
Dundalk: Enda Minogue; Sean Keogh (Andy Paraschiv 46), Vincent Leonard, Sean McHale, John Ross Wilson; Aodh Dervin, Harry Groome (TJ Molloy-Murray 85), Daryl Horgan, Eoin Kenny (Declan McDaid 61); Gbemi Arubi (Keith Ward 61), Dean Ebbe.
Referee: Declan Toland (Roscommon).
Elsewhere, second-placed Cobh Ramblers were unable to capitalise on Dundalk's woes as they slipped to a 2-1 defeat at Treaty United.
After a scoreless first half, Connor Wilson gave Treaty the lead five minutes after the break. But Cian Murphy levelled for Cobh on 57 minutes.
However, all three points would stay in Limerick as Mark Byrne netted Treaty's winner three minutes from time to settle the Munster derby meeting.
Treaty remain fourth in the table, while UCD remain level on points with them after a 3-1 victory over Finn Harps at the Bowl.
Sean Brennan gave the Students the lead on 16 minutes but Harps drew level five minutes later via Conor Tourish's goal.
However, UCD sealed the win with goals either side of the interval, scored by Mikey McCullagh and Mikey Raggett.
Wexford stay sixth as they failed to find a way past bottom side Athlone in a 0-0 draw at Ferrycarrig Park. The result leaves Stephen Elliott's side six points outside the promotion play-off places.