It was a late, late show from Hednesford Town as the Pitmen recorded their first league victory since early November thanks to a goal from new signing Isaac Cooper five minutes into injury time.
Cooper had only been introduced to his teammates in the build-up to the game after signing from Darlaston Town 1874 over the Christmas period.
Hednesford made the better start of the two sides with Osebi Abadaki seeing his effort cleared from in front of the line in the third minute before the winger was forced off with an injury 15 minutes later.
His replacement Ryan Shaw saw a shot palmed away soon afterwards before Josef Bursik had to react quickly at the other end to deny Jordan Harrison.
It would be the Pitmen who would take the lead right on the stroke of halftime though when a long throw found its way to Dan Cockerline with the striker making no mistake to fire high into the net.
The home side pressed for an equaliser at the start of the second half but the Pitmen were able to cope with what was asked of them.
However, Ferriby would be awarded a penalty in the 75th minute when a Pitmen player was adjudged to have handled the ball inside the box. Tom Waudby stepped up to send Bursik the wrong way and bring his side level.
In the 87th minute Hednesford were awarded a penalty of their own when Shaw was fouled in the area. Ferriby striker Gary Bradshaw was dismissed for his protestations but the Pitmen failed to take advantage as Cockerline saw his spot kick turned behind by Lewis Exall in the United goal.
Just when it looked as if the Pitmen would be denied all three points, they won the game with 30 seconds left as the ball pin-balled around the home box and Isaac Cooper was on hand to slot home – giving those hardy souls who had made the journey something to cheer about.
North Ferriby United: Exall, Nichols, Windass, Lamplough (Hutchinson 57), Piercy, Williamson, Waudby, Smith, Harrison (Nichols 71), Harrison (Bradshaw 57), Leyland
Subs not used: Martindale
Hednesford Town: Bursik, Dawes, Fox, Bailey, Gatter, King, Dodd (Howard 79), Hallahan, Cockerline, Abadaki (Shaw 18), Logan (Cooper 59)
Subs not used: Veiga, Davies