Substitute Rory Patterson scored twice as Derry City beat St Patrick's Athletic 3-2 in a dramatic FAI Ford Cup Final at the Aviva Stadium.
A dull game came to life when Sean O'Connor's curling free-kick put St Pat's in front on 50 minutes.
The lead was short-lived as Stewart Greacen headed an equaliser from Barry McNamee's cross.
Patterson put Derry ahead from the penalty spot after a howler by Brendan Clarke led to him upend Stephen McLaughlin in the box.
Christy Fagan sent the game to extra-time when he poked in O'Connor's cutback with three minutes left.
Patterson grabbed his second of the day and the winner in the first half of extra time when he pounced on a weak header from Kenny Browne.
He held off Conor Kenna and kept his head to skip past Clarke before rolling the ball into the unguarded net.
Simon Madden had a fourth goal ruled out for offside. The long wait for an FAI Cup victory goes on for St Pat's, who have now lost seven finals since they last won in 1961.
The victory was Derry's fifth since they joined the League of Ireland in 1985 and one that had looked unlikely after a poor first half.
St Pat's will feel they were they better team for much of the game, but they lost concentration at key moments and their mistakes were clinically punished.
The attendance of 16,117 was down on last two finals at the venue, but there was still plenty of colour and noise and the final 75 minutes were a great advert for the domestic game.
St Pat's settled better in an opening half short on entertainment, only to be let down by their final ball. A Jake Kelly header and a long-range effort from Chris Forrester were all they had to show for their first-half dominance.
St Pat's suffered a blow midway through the half as Jake Carroll limped off following a challenge with Dermot McCaffrey, which had seen the Pat's man booked.
Derry broke forward on rare occasions in the half and they seemed content with stopping St Pat's.
Yet they could have led at the break if David McDaid had taken the half's best chance. The striker's spectacular bicycle kick flew over the bar when it looked easier to take a step back and head in Madden's cross.
If the first half was dull and uneventful, the second 45 minutes was anything but, as the game kicked into life with two goals in a minute.
McCaffrey's foul on Forrester gave St Pat's a free-kick on the edge of the box. O'Connor made the defender pay as he coolly curled the ball over the wall and in to the corner.
St Pat's fans had little time to celebrate with Derry levelling at the first opportunity. Greacen outjumped Kenny Browne to head in McNamee's in-swinging free-kick.
The game had been dormant for 50 minutes, but it was now swinging from end-to-end with both keepers called into action.
Clarke will have nightmares about the howler that allowed Derry take the lead. The keeper was trying to be cute but only succeeded in passing the ball straight to McLaughlin.
He tried to redeem himself but bundled over McLaughlin in the process of rectifying his error. Patterson stepped up to send Clarke the wrong way from the spot.
Forrester almost brought St Pat's level when his glancing header from John Russell's cross went narrowly wide with Doherty stranded.
As Liam Buckley's side chased the game they left gaps at the back and McLaughlin was denied a third goal on two occasions by last-ditch blocks.
Derry looked to have the trophy in their grasp until Fagan's late intervention. O'Connor bounced on a fumble by Gerard Doherty and Fagan was on the spot to turn the ball home.
The action did not abate in extra time and Patterson struck the crucial goal just before the break.
Browne's tame header back towards goal was nowhere near Clarke, which allowed Patterson the opportunity to write his name in Derry history.
The Candystripes thought they had a fourth after a counter-attack but Madden's joy turned to despair when the flag was raised. It mattered little as the trophy goes north once again.