Rory Gaffney fired home the winner in the dying seconds, sparking jubilant scenes on a night of high drama in Tallaght.