Leon Legge snatched a late equaliser as Gillingham fought back from two goals down to draw at League 1 promotion chasers Preston on Tuesday night.
Gills were overrun in the first half and trailed 2-0 at the break. But Jermaine McGlashan gave them hope before Legge levelled with a looping header in injury time.
Preston should have led inside a minute, with unmarked Joe Garner blowing an easy chance from Jermaine Beckford's far-post cross.
Another opportunity fell Garner's way soon after, this time from Callum Robinson's centre, but Glenn Morris was equal to a decent header.
Morris saved Gills again when he came off his line to pull off a superb block from Beckford, whose follow-up effort was cleared off the line by Max Ehmer.
Chances continued to come Preston's way with Beckford's first-time effort from another Robinson cross clearing the bar when he might have done better, then Robinson tested Morris from the edge of the box after collecting Scott Laird's pass.
It was one-way traffic as the dangerous Robinson then played in Beckford who rolled the ball inches wide of Morris' far post.
Gillingham managed their first effort on goal when Amari'i Bell's 20-yard strike from Doug Loft's quick free-kick was held by Sam Johnstone.
But on 36 minutes Justin Edinburgh's men were behind with Beckford racing through from Garner's pass and finishing emphatically.
Paul Gallagher fired over from 25 yards and Garner sent a diving header wide from Laird's cross before Gillingham conceded again at the end of two minutes' injury time.
It was an awful goal to ship as Robinson worked his way across the edge of the area unchallenged before beating Morris with a low strike.
Gills made a better start to the second half, showing early promise with Bell attacking down the left, before John Marquis headed wide from Doug Loft's cross.
Preston remained dangerous, Morris holding decent efforts from Johnson and Robinson, but Gillingham were back in the game on 58 minutes when McGlashan shook off a defender from Marquis' pass and poked the ball past Johnstone.
The goal triggered a decent little spell for Gills who had the ball in Preston's box several times over the next few minutes, Bradley Dack denied by the keeper.
North End looked uncomfortable but threatened a third on the break with Morris making a superb save from Garner's strike.
It looked like Preston would hold on but Legge's terrific header earned Gills a draw.
Gillingham: G Morris, Egan, Ehmer, Legge, Loft, Marquis, McDonald (Norris 69mins), McGlashan, A Morris (Pritchard 90mins), Bell (Dickenson 69mins), Dack. Subs not used: Nelson, Hessenthaler, Muldoon, Hoyte.
Attendance: 9,417 (127 from Gills)