Coleraine moved into second spot in the Irish Premiership and further dented Linfield's title hopes by beating the champions at the Showgrounds.
Darren Boyce shot right-footed past the advancing Alan Blayney on 13 minutes and Curtis Allen fired low into the bottom corner two minutes later.
Michael Carvill's curling free-kick made it 2-1 and Ryan Henderson stabbed the ball home with a minute remaining.
Stephen Lowry drove home a dramatic winner two minutes into added time.
Linfield began the game strongly and Peter Thompson's glancing header went just wide.
Boyce scored the opener when he collected a through ball from Allen and beat Blayney.
At the other end, Michael Doherty saved a deflected Michael Carvill effort and recovered quickly to stop Thompson's shot from the rebound.
The impressive Allen added the second with a low left-foot strike for his fifth league goal of the season.
Carvill's right-foot free-kick from just outside the area on 26 minutes reduced the Blues' deficit and the diminutive striker then went close on the half hour when he turned and shot just wide.
Peter Thompson looks incredulous after being denied a penalty claim
Before half-time, Doherty raced off his line and appeared to bring down Thompson, but referee Raymond Crangle waved play on as the visitors appealed for a penalty.
The end-to-end action continued in the second half as Mark McAllister brought another fine save from Doherty after a defensive blunder.
Aaron Canning fired a right-foot shot just wide of the post, while Blayney saved from Allen.
Doherty palmed away a Thompson piledriver and Ruairi Harkin fired over.
Substitute Henderson headed over but equalised after Carvill had flicked on Niall Quinn's inswinging free-kick.
In a frenetic finish, Canning's cross from the right found Lowry and the midfielder took one touch before blasting a right-foot drive past the helpless Linfield goalkeeper.
The Bannsiders almost scored the fourth when Ciaran Clarke hit the bar and then Philip Lowry could have equalised but shot over.
Linfield, who remain in eighth position, are at home to Portadown on Saturday while the Bannsiders travel to Seaview to face Crusaders.
After the game, Linfield boss David Jeffrey lambasted the decision of the officials not to award his side a penalty.
"If that wasn't a penalty, I don't know what is, it is absolutely ridiculous," fumed the Blues boss.
"It's decisions like that which cost you games of football and there is no excuse for that.
"How on earth the referee and linesman didn't see it I will never, never know."