Cavan were caught napping early on and a point apiece from Sean McCormack and Paul Barden fired Longford ahead.
The visitors flattered to deceive though and a McDermott point was sandwiched by two Raymond Galligan frees as Cavan edged into a 0-3 to 0-2 lead by the 21st minute.
McCormack ended a 32 minute barren spell to cut Cavan’s lead to 0-4 to 0-3 at the interval.
Longford were a different proposition on the restart and impressive sub James McGivney eased his side ahead (0-5 to 0-4) after 41 minutes.
A Eugene Keating free three minutes from time left just a goal between the sides but Cavan never looked like bagging the goal to get them out of jail.
CAVAN: J Reilly; D Barkey, O Minagh, R Flanagan; R Maloney-Derham, P O’Reilly (0-1), D O’Reilly; D Givney, G McKiernan; N Smith, N McDermott (0-2), K Meehan; B Fitzpatrick, E Keating (0-2, one free), R Galligan (0-2, both frees).
Subs: M Dunne for R Galligan (half-time); D O’Dowd for D O’Reilly (41); D McKiernan for B Fitzpatrick (54); R Cullivan for K Meehan (60); C McClarey for G McKiernan (67).
LONGFORD: D Sheridan; D Brady, B Gilleran, D Reilly; S Mulligan, M Quinn (0-1, ‘45), C P Smyth; B McElvaney, J Keegan; D Barden, P Barden (0-2), N Mulligan; R Smyth, S McCormack (0-4, two frees), JJ Matthews.
Subs: P Foy for S Mulligan; J McGivney (0-2) for N Mulligan (half-time); D McElligott (0-1) for R Smyth (half-time).
Referee: B O’Shea (Dublin).