Having won just once in their previous 12 games, few gave Harps much chance of causing an upset against fifth-placed Longford. But spurred on by Kevin McHugh - who chipped in with his 100th league goal - there is new hope for the Donegal club.
They are still bottom of the league but are now just three points adrift of Waterford. Significantly they have a better goal difference.
McHugh and Chris Breen both scored twice, with Conor Gethins the other goalscorer.
Harps have four games left - away to Drogheda and Shelbourne, and home to UCD and Bray.
In the First Division yesterday Kilkenny City visited Cobh and came away with both points in a 2-0 victory. Brian McCarthy scored in the first minute and Philip Sheppard made sure of the win 11 minutes from time.
Kildare County hosted Dundalk in a 1-1 draw, Kildare finishing the game with ten men. Former Dundalk star Martin Reilly got the Kildare goal 17 minutes in. Dundalk equalised through David Hoey on 59 minutes and Kildare had to hang on for the final six minutes when ‘keeper Tom Corley saw red for a professional foul.