James Kavanagh's 72nd-minute goal left Cavan stunned as Kildare squeezed their way into the second round of the qualifiers in Newbridge tonight.
After good approach work from Mick Foley and Dermot Earley, Kavanagh decisively left-footed his shot under Cavan goalkeeper James Reilly.
Cavan, who were 0-10 to 0-06 behind at half-time, had made a surge with five straight points to lead by two before Kavanagh's strike.
Kildare's John Doyle impressed with five first half points, while handball champion Paul Brady was Cavan's 36th-minute goalscorer.
The Breffni men had led early on but it was Kildare who dominated the middle section of this match, which saw referee Cormac Reilly dish out three yellow cards before the throw-in.
Cavan front men Seanie Johnston and Eddie O'Reilly and Kildare corner-back Andrew McLoughlin all saw yellow for an early coming-together.
When the action did get underway, Ronan Flanagan nudged the visitors ahead and the sides were level three times in the opening ten minutes.
The game was quickly up to Championship pace with Padraig O'Neill scratching out Flanagan's effort with a fine score off the outside of his right boot.
John Doyle was Kildare's go-to man, in terms of scores, and he hit two excellent scores before Martin Reilly and Dermot McCabe replied for Cavan.
Kildare, who were only winning their second league or Championship game this year, began to click soon after with their midfield pairing of Earley and Killian Brennan getting on top.
Kildare boss Kieran McGeeney, whose side were stunned by Wicklow last time out, watched on as Doyle, Eamonn Callaghan and Ken Donnelly hit successive points.
Twice in the opening half Cavan went 13 minutes without scoring and although they ended the half with injury-time points from Eddie O'Reilly and Johnston, Kildare, whose passing was crisper, still had a decent lead at the turnaround.
Cavan then turned the game on its head just 30 seconds into the second period, when Brady fisted home his goal after doing well to get in on the end of a dropping ball.
Kildare's response was a strong one as they strung together four points, with Emmett Bolton, Doyle, who took his tally to 0-07, and Donnelly all bisected the posts.
Cian Mackey swapped points with Alan Smyth and Doyle's eighth of the evening still had the Lilywhites three points ahead.
But Cavan then hit another purple patch that had them within reach of a comeback win. Eddie O'Reilly and McCabe (two frees) had the sides back level at 1-13 to 0-16.
Another McCabe free, with four minutes remaining, shot Donal Keogan's men ahead and a 70th-minute effort from Johnston, who gave his marker McLoughlin a torrid time, suddenly had the Ulstermen two points ahead.
Nonetheless, two raids forward by Foley and Earley ended with Kavanagh brilliantly slipping home the match-winning goal for a relieved Kildare side.
Kildare: E Murphy; M O'Flaherty, D Hendy, A McLoughlin; E Bolton (0-01), M Foley, K O'Neill; K Brennan, D Earley (0-01); J Kavanagh (1-00), P O'Neill (0-01), E Callaghan (0-01); A Smyth (0-02), K Donnelly (0-02), J Doyle (0-08, 4f)).
Subs: M Scanlon for Hendy (61 mins), P Mullarkey for P O'Neill, M Conway for Smith (both 68).
Cavan: J Reilly; M Cahill, M Hannon, D Sheridan; A Forde, M McKeever, B Watters; E Keating, D McCabe (0-04, 4f); P Brady (1-00), R Flanagan (0-01), M Reilly (0-01); S Johnston (0-06, 3f), E O’Reilly (0-02), C Mackey (0-01).
Subs: P O'Reilly for Reilly (40 mins), N Walsh for Keating (46).
Referee: Cormac Reilly (Meath).