Supersubs Ethan Devine and Jamie Mulgrew dragged Linfield back from the brink to fire David Healy’s men into the second qualifying round of the Champions League.
With time running out it looked as if The New Saints, who boasted a 1-0 lead from last week’s first leg in Oswestry, had applied the last rites to the Belfast club’s campaign.
But skipper Mulgrew, a 78th minute replacement for Ben Hall, rifled a stunning equaliser into the top corner in the 94th minute to force extra-time.
Read more: Ipswich Town a late addition to this month's SuperCup NI
And Devine, who earlier rattled the crossbar, made it 2-0 on the night and 2-1 on aggregate with a close range finish five minutes into the additional half-hour.
It was a frantic turnaround and a result that tees up a second round meeting with Norwegian champions Bodo Glimt who beat Celtic in last season’s Europa Conference League.
Linfield, chasing a 27th win in Europe dating back to the club’s first foray into European competition in 1959, created the better of the chances in the opening period.
The best of them came in the 19th minute when Daniel Finlayson met a Stevie Fallon cross, but the right-back’s header was saved low to his left by Connor Roberts.
Robbie McDaid also eyed up an opening when he met a teasing Shields cross before the break, but the summer signing's diving header was straight at the keeper.
The Welsh champions, with only one defeat in their previous seven European ties, were almost ahead eight minutes into the second half but Chris Johns got down to parry a header from former Aberdeen striker Declan McManus.
With the tie slipping away from Linfield, Healy made a number of changes and young striker Devine, scorer of so many crucial last gasp goals last season, and captain Mulgrew were sprung from the bench in the 78th minute.
Devine went on to rattle the crossbar from a Kirk Millar cross in the 91st minute before Mulgrew forced extra-time with a stunning strike three minutes later.
Millar’s corner was half cleared and the midfielder picked up the pieces to arrow a laser beam of a shot into the top corner. It was a picture book strike.
Linfield won it five minutes into the first half of extra-time when Chris McKee drilled a low cross for Devine to sweep home at the near post.
Joel Cooper was stretchered off with a muscle injury in the 112th minute and with all their substitutions used, the Blues had to see out the remaining eight minutes with 10 men.
But Johns got down to smother efforts from Ryan Brobbel and McManus as the Irish League champions booked their place in the next round.
-
Joely Andrews: We don't want to be remembered as the only NI team to reach a major finals
-
NI teenager Sean McAllister eager to follow Price path after signing new Everton deal
-
Northern Ireland teenager praised after Derby County secure pre-season win at Bradford City
-
Rangers teenager Charlie Lindsay says six-goal defeat to Glentoran was a "learning curve"
Sign up to our free sports newsletter to get the latest headlines to your inbox.