Leinster champions Dublin put in a far from convincing performance against Longford as Conal Keaney dragged them to a 1-12 to 0-13 win at a packed-out Pearse Park.
15,213 fans crammed into the midlands venue to watch Longford almost pull off a shock win. Keaney's 0-08 haul – 0-06 from placed balls – was crucial in steering the Dubs through to the semi-finals.
Mark Vaughan goaled from a long Shane Ryan delivery to see the Dubs lead 1-07 to 0-06 at the interval.
Four late points from Jamesie Martin, Peter Foy, David Barden and Brian Kavanagh saw Longford to within two, but Paul Caffrey's visitors held on.
The hosts, still reeling from last year's 19-point hammering at the hands of the Dubs at Croke Park, began the brighter with free-taker Paul Barden slamming over his first point of the afternoon in the first-minute.
Alan Brogan cancelled out that score but Longford quickly got to grips with the stifling heat and the midfield battle was swaying towards the home side's Liam Keenan and Bernard McElvaney, who is still an Under-21 panellist.
Four successive points from Barden (free), McElvaney, championship debutant Padraig Berry and Kevin Mulligan had Longford 0-05 to 0-01 in front before two Keaney efforts reeled them back in.
Keaney's third followed on 20 minutes, Trevor Smullen replied, but Vaughan's clinical goal finish three minutes later saw the Dubs take the lead. Ryan's ball through caught Enda Ledwith badly out and the Kilmacud Crokes attacker did the rest, beating Longford keeper Damien Sheridan with a powerful finish.
Bryan Cullen and Kevin Bonner, who was making his championship bow, added points for the Dubs who were four points clear at half time.
Wind-assisted for the second half, Longford quickly got about their business with David Barden raising a white flag to put a goal between the sides. The same player was denied a goal moments later when Stephen Cluxton came to Dublin's rescue and two missed 45s from the boot of Barden's brother Paul dented the hosts' challenge.
Three points from Keaney and one from substitute Declan Lally were replied to by Paul Barden as the Dubs, with Ciaran Whelan and Ryan now in the ascendancy at centre-field, raced into a 1-11 to 0-08 lead.
Almost immediately, Longford rallied with four points on the trot. Substitute Martin and Foy clipped over scores, Kavanagh notched a free from close range and the impressive David Barden fired over from play.
Now just two points ahead, the Dubs were sweating. Keaney was again to their rescue as he kicked his eighth of the encounter right on 70 minutes. One last Longford attack garnered a free which Kavanagh converted as time ran out on Dempsey's charges.
Afterwards, Dublin selector Brian Talty conceded: "We knew Longford had an awful lot of good footballers - we were expecting a good showing from them and we were really hanging on at the end.
"It was a different challenge to come down to Longford.
"We're lucky enough to be in it still. Longford missed a lot of frees. We've a lot of problems and many things to get sorted out before the Leinster semi-final (against Laois). We're not happy with the performance and we're blessed to get out of here today," he told RTE Radio One.
Longford: D Sheridan (capt); D Brady, N Farrell, E Ledwith; C Conefrey, A O'Connor; D Reilly, B McElvaney, L Keenan; T Smullen, P Barden, P Berry; D Barden, K Mulligan, B Kavanagh.
Dublin: S Cluxton; N O'Shea, B Cahill, D Henry; P Casey, C Goggins, P Griffin; C Whelan, S Ryan; K Bonner, A Brogan, B Cullen; T Quinn, C Keaney, M Vaughan.
Referee: Joe McQuillan (Cavan)