Fermanagh edged out Westmeath in a thrilling opening Football qualifier at Mullingar despite hitting 20 wides.
Conor Quigley's long ball went into the net as Fermanagh led 1-3 to 0-2 before Damien Kelly hit their second goal as they led by four at half-time.
However, a John Heslin penalty then helped Westmeath take a one-point lead.
A superb Ryan Jones goal put Fermanagh ahead again and while Westmeath levelled, a last-gasp John Woods point sealed the Ernemen's victory.
Woods had performed well in his main role of marking the dangerous Denis Glennon but the corner-back stormed upfield in stoppage-time to hit the winner after his forward colleagues had missed numerous glorious scoring chances during the previous 70 minutes.
Glennon hit the opening score of the match but, helped by the first-half breeze, Fermanagh responded with three straight Sean Quigley points.
After Heslin had replied for the home side, Fermanagh notched their opening goal as Westmeath keeper Gary Connaughton appeared to misjudge Conor Quigley's long ball in the sunny conditions, with the other Quigley brother also causing some consternation in the Westmeath square.
Fermanagh's other corner-back Kelly ran upfield in the 25th minute to hammer in his team's second goal after good work by Shane McCabe.
The score helped the Ernemen lead 2-5 to 0-7 at half-time but the advantage should have been greater at that stage after Fermanagh's 12 first-half wides.
Westmeath took control in the 10 minutes after half-time and went ahead by the 45th minute, helped by Heslin's penalty.
Heslin tucked away the spot-kick after Fermanagh keeper Chris Snow had been given little option but to haul down Glennon.
The penalty levelled the contest and Westmeath looked the likely winners when the goal was immediately followed by a Ger Egan point.
But the game turned again within moments as Jones, who had been guilty of a number of bad wides, struck a sensational goal as he lashed the ball home from 20 yards after taking a ball at pace some 50 yards out from the Westmeath posts.
The Jones goal was followed by Sean Quigley and Tomas Corrigan points as Fermanagh moved four ahead but Westmeath responded with three straight scores to leave the minimum between the sides again.
Crucially after a number of missed frees, Sean Quigley slotted a 40-metre effort to double Fermanagh's advantage and Westmeath were then reduced to 14 men with Kieran Martin was dismissed after getting a second yellow card.
But extra-time appeared on the cards when two Callum McCormack points had the sides level again a minute from the end of normal time.
However, there was to be a further late twist as Woods strode upfield to stroke over the winner as Fermanagh notched their first championship victory in eight attempts.
All-Ireland SFC qualifiers - first round
Friday 28 June
Carlow 0-12 3-13 Laois
Saturday 29 June
Offaly 0-08 1-27 Tyrone
Louth 1-17 1-11 Antrim
Westmeath 1-15 3-10 Fermanagh
Longford 2-14 0-9 Limerick
Galway 1-12 0-11 Tipperary
Sunday 30 June
Armagh v Wicklow (Athletic Grounds, 15:00)
Derry v Sligo (Owenbeg, 17:00)