Substitute Conor Cosgrove's nerve of steel landed a first ever Leinster Club SFC title for Westmeath champions Garrycastle.
Just seven minutes after coming into the action at O'Connor Park, he was handed the responsibility of taking a pressure free kick in stoppage time, and nailed the 25-metre kick to give his side a 1-8 to 0-10 win.
Four Dessie Dolan points gave Garrycastle a 0-6 to 0-1 interval lead, and they went eight clear with a Gary Dolan goal.
But Dublin champions St Brigid's, inspired by Paddy Andrews, displayed massive courage to battle back from eight points behind to draw level in the dying moments.
Gavin McIntyre's late leveller looked set to send the game to extra-time, but Gallycastle, who had gone 23 minutes without scoring, had one more trick in the bag, and clinched it with the very last kick of the game.
Dessie Dolan will come up against first cousin Frankie when his side takes on another St Brigid's side, the Roscommon champions, in the All-Ireland semi-final.