Derry City scored three second-half goals to reach the semi-finals of the Setanta Cup.
Linfield took the lead in the 31st minute of the second leg tie through Philip Lowry, which put the Blues 2-1 ahead on aggregate at the Brandywell.
Derry skipper Barry Molloy's superb header got the home side back in it on 69 minutes.
Stephen McLaughlin put them in front for the first time before Simon Madden added a third goal in stoppage time.
The teams drew 1-1 in the first leg at Windsor Park and it was all to play for.
Around 500 Linfield supporters made the trip to the Brandywell, but they were prevented from entering the ground until just before kick-off for security reasons.
Derry started brightly, Farren and McDaid with early half chances. Alan Blayney made a great save low to his right from a Higgins' free-kick.
The first 20 minutes were scrappy but after that Linfield began to dominate.
The visitors broke the deadlock with their best moment of quality in the final third.
Michael Carvill slid a lovely ball through to Lowry, who timed his run into the box perfectly, and with the outside of his right foot tucked the ball past Doherty for his first ever Setanta Cup goal.
Linfield pushed on and grew in confidence after Lowry's 31st minute strike.
They were by far the better side up to half-time and Peter Thompson had a penalty appeal turned down after a tussle with Greacen.
The Blues remained on top after the break but the tide began to turn midway through the second half as Derry scored three times in the last 25 minutes.
The equaliser came on 69 minutes when Madden's deep cross was brilliantly met in the air by Barry Molloy's looping header from 12 yards out.
Derry were now the team with the momentum and looked most likely to get the all-important winner.
It duly arrived in the 77th minute from midfielder Stephen McLaughlin who got on the end of a slick move involving McEleney and Farren to bury a low shot into the far corner of the net.
Linfield pushed up looking for the second away goal but they got caught on the break deep in injury-time after Steven Douglas lost possession.
Simon Madden made them pay with a great solo effort, squeezing the ball in at Blayney's near post in the fourth minute of stoppage time.