Olly Lee’s injury-time winner ended the Hatters’ hoodoo at York to give Nathan Jones his first back-to-back victories in charge.
After a forgettable and goalless first half, the Town ended a 10-hour wait for a goal at Bootham Crescent when Cameron McGeehan headed home his 12th goal of the season eight minutes after the break.
However, the lead lasted just 11 minutes when City substitute Bradley Fewster levelled after seizing on Stephen O’Donnell’s poor back pass.
But the Town restored the lead with 16 minutes to play when O’Donnell’s cross was turned home by Jack Marriott’s clever close-range finish.
Things are never easy following the Hatters though, and York equalised with eight minutes left on the clock when Fewster finished well to make it 2-2.
At that point the three points looked lost for the Town but, three minutes into five added at the end of the 90, Lee had the final word when running forward from midfield unchallenged before lashing home a low left-foot drive from the edge of the box.
The goal sealed a second win in a week, the Hatters’ eighth away win of the campaign, but a first at Bootham Crescent since a 2-1 victory in September 2001.
It all began with Nathan Jones naming an unchanged side following last weekend’s late win over Hartlepool. There was one change on the bench, where Paul Benson replaced Ryan Hall.
The first half, however, showed little to indicate any of the drama that would follow in the second 45 minutes. Both sides struggled in a mundane half that saw Mark Tyler save well from Vadaine Oliver in York’s best chance.
The Town failed to force home goalkeeper Michael Ingham into any meaningful action in the first half but, eight minutes after the break, McGeehan broke the Hatters’ long run without a goal at Bootham Crescent.
Danny Green’s left-wing corner was met by the midfielder’s head in the six-yard box and the Town celebrated a first goal in 608 minutes at the Yorkshire venue stretching back six goalless games.
Tyler needed to be alert to keep the lead intact on the hour when flying to his left to keep out Luke Summerfield’s free-kick but, three minutes later, York were level. O’Donnell got the weight and accuracy of his back-pass to Tyler all wrong, allowing Fewster – on the half-time – to nip in and race through and tap home from close range to make it 1-1.
However, it did not take the Town long to restore their lead when, on 74 minutes when, O’Donnell made amends for his error by setting up Marriott for his 10th goal of the season. The striker was in the right place at the right time to flick home a fancy finish in the six-yard box to make it 2-1.
Back in front the Hatters looked the more likely to extend their lead, but York had other ideas and duly levelled for a second time with eight minutes left on the clock. The Hatters defence failed to keep tabs on Middlesbrough loanee Fewster and he sent a composed finish beyond to Tyler from the left-side of the penalty area to make it two apiece.
Hurt, the Town responded well again; O’Donnell’s cross-shot bounced wide on 83 minutes before the right-back then nodded wide at the back-post following Jake Howells’ cross with five minutes left.
Moments after five additional minutes were indicated by the officials, substitute Craig Mackail-Smith saw a firm shot well-blocked Dave Winfield in the area and at that point it looked as though the Town would have to settle for a point.
In the third minute added minute, Lee picked up the ball in the centre circle and drove forward. With no York challenge the midfielder continued goalwards before letting fly with a sweet, low, left-foot finish that flew past the outstretched arm of Ingham to send the Town players and over 700 supporters into ecstasy.
The goal knocked the stuffing out of York and the Town were able to see out the remaining few minutes to clinch an eighth away win of the campaign and a first at Bootham Crescent in seven attempts.
With a home game against Morecambe on Tuesday night, make sure you get down to Kenilworth Road. Who knows where this season could head…
Town: Tyler; O’Donnell, Howells, Cuthbert, Sheehan (sub Okuonghae 87); Lee, Lawless (sub Smith 61), McGeehan; Marriott, Green, Pigott (sub Mackail-Smith 61).
Subs not used: Benson, McCourt, Ruddock, Justham.
Attendance: 3,628, including 715 supporting the Town.