Inspired by skipper Michael Duffy at one end and the brilliance of goalkeeper Brian Maher at the other, Derry City leapfrogged Bohemians into second place in the Premier Division table with victory in a rollercoaster of a game at Dalymount Park.
Only a second win from their last seven games edges Derry two points ahead of Bohemians, though seven behind leaders Shamrock Rovers having played two games more.
A promising beginning for Derry mattered not as they found themselves a goal down to another early penalty in Phibsborough on nine minutes.
A second-minute Dayle Rooney spot-kick gave Bohs victory in the last clash between the side in Dublin 7 at the end of May.
Rob Hennessy was the man in the middle that night, awarding a penalty following a contentious handball against Mark Connolly.
It looked a harsh decision here when James Clarke went to ground under a challenge from Carl Winchester.
But Hennessy had no hesitation in pointing to the spot, with Douglas James-Taylor scoring emphatically from 12 yards.
Derry responded positively to deservedly level on 20 minutes with a fine goal on the counterattack.
Duffy initially put Afolabi 'Dipo' Akinyemi in over the top to fend off defender Rob Cornwall.
And though the big striker’s shot was parried by Kacper Chorazka, the ball ran for Duffy, who drilled it to the far corner of the net for his ninth league goal of the season.
Bohs played their way back into the match and would have been back in front on 36 minutes but for the brilliance of Maher, who pushed away James-Taylor’s downward header from a Jordan Flores cross.
It proved a big save as Derry turned the game on its head by taking the lead a minute before the interval.
Bohs failed to clear a Duffy corner. Adam O’Reilly pounced on the loose ball with a shot that squirmed under Chorazka.
With Derry defending tenaciously into the second half, Bohs were having to graft to regain a foothold in the game.
And no-one was working harder than Ross Tierney, who was instrumental in their equaliser on 65 minutes.
Initially winning the ball, Tierney worked a one-two with Rooney on the right to put over a low cross that was tapped home at the far post by Flores.
Criminally, Bohs conceded almost immediately when losing the ball 30 yards from their own goal. Winchester set up the lively O’Reilly to slip the ball past Chorazka for his second goal of the night.
Bohs levelled again on 71 minutes, James-Taylor crashing the ball to the net from Tierney’s free-kick for his fifth goal since joining in July.
But yet again Bohemians conceded just four minutes later for what proved the winner; Duffy once more the instigator, whipping over a cross for Dipo to head home.
Derry lost wing-back Ronan Boyce to a second yellow card on 77 minutes before Maher came inspirationally into his own with a string of saves to frustrate Bohs late on, the pick of them from Clarke and Flores in stoppage time.
Bohemians: Kacper Chorazka; Jubril Okedina (Connor Parson 69), Rob Cornwall (Colm Whelan 81), Jordan Flores; Niall Morahan, Archie Meekison (Keith Buckley 69; Dayle Rooney, Ross Tierney, Adam McDonnell (Cian Byrne h-t); James Clarke, Douglas James-Taylor.
Derry City: Brian Maher; Alex Bannon (Cameron Dummigan 89), Jamie Stott, Sam Todd; Ronan Boyce, Carl Winchester (Hayden Cann 81), Sadou Diallo (Robbie Benson 70), Brandon Fleming; Adam O’Reilly, Michael Duffy; Afolabi ‘Dipo’ Akinyemi.
Referee: Rob Hennessy (Clare).
Attendance: 4,006.