Glentoran suffered their first defeat of the season in the County Antrim Shield quarter-final at the Oval.
Brian McCaul fired Linfield into a 24th-minute lead but Jim O'Hanlon got the Glens level 10 minutes later.
Former Glens player Daryl Fordyce scored to give the Blues a 2-1 lead, but Jimmy Callacher headed the home side's second equaliser in the 88th minute.
The tie looked like it was going to extra-time until Peter Thompson beat Elliot Morris with a header just 45 seconds after the Glentoran equaliser.
Thompson and Glentoran manager Eddie Patterson gave their reaction to the game after the final whistle.