Crewe kept up the pressure on League Two leaders Swindon as Chris Porter’s double secured a 2-1 win over Crawley.
It looked like the front-runners might have to settle for a point after Nathan Ferguson’s late spot-kick cancelled out Porter’s earlier penalty.
But Porter headed in at the far post with a minute to go to earn the Railwaymen a fourth consecutive win.
Before the late drama, Crewe found Glenn Morris a notable obstacle at Gresty Road with the Red Devils’ goalkeeper producing a string of fine stops.
Dangerman Charlie Kirk went close twice early on and had an effort chalked off for offside after applying the finishing touch when Morris palmed out James Jones’ effort.
Jones sent a blistering drive over from distance but was not so impressive from close range when he skewed the ball wide after Morris pushed out a fierce drive from Harry Pickering.
Pickering was thwarted again by some excellent work from Morris just before the break and, after the restart, Morris kept out Stephen Walker’s far-post smash after Pickering sent over a free-kick.
Crewe finally made the breakthrough when substitute Callum Ainley was tripped by Jamie Sendles-White as he raced to the byline in the 72nd minute.
Porter stood up and sent Morris the wrong way from 12 yards.
Will Jaaskelainen preserved the lead when tipping George Francomb’s effort around the post but he was beaten by substitute Ferguson’s 84th-minute spot-kick, awarded when Jordan Tunnicliffe was barged in the box by Porter.
Porter made up for his mistake at the other end, however, stretching to head in Jones’ cross at the far post.