Port Vale leapfrogged Gillingham to move to the top of League Two with a victory at the Priestfield Stadium.
Vale started the game two points behind the Gills, and went ahead when Tom Pope headed home Adam Yates's cross for his 26th goal of the season.
The visitors were 2-0 up when Adam Barrett turned into his own net under pressure from away debutant Lee Hughes.
Danny Kedwell's strike from the edge of the box reduced the deficit, but Gills could not find that elusive equaliser.
Striker Adam Birchall came closest to levelling matters, but Ashley Vincent cleared his effort off the line.
Vale also had goalkeeper Chris Neal to thank after he somehow managed to keep out Charlie Lee's thunderous header.
And the away side clung on to claim three points at the Priestfield Stadium, where they had only won just once in their last 16 visits prior to kick-off.
VIEW FROM THE DRESSING ROOM
Gillingham manager Martin Allen told BBC Radio Kent:
"I was disappointed not to get anything, it was a terrific performance second half and we couldn't get the equaliser, but you don't want to be 2-0 down in the first place.
"We had a lot of opportunities, a lot of crosses that were good. Sometimes you just need someone to take the break, that chance, but away from home we've done that, so let's not hand out any criticism.
"It's just unlucky we didn't get another chance in the second half, but we don't want to give those goals away at Priestfield because it knocks you back.
"The winning team only gets three points, but if we'd won we would have been five points clear with a game in hand and that would have been significant. We have got to learn and we have to improve what we do here."
Live Text Commentary
Full Time The final whistle is blown by the referee.90:00 +4:18
Outswinging corner taken by Joe Martin, clearance by Liam Chilvers.90:00 +3:13
Effort from the edge of the area by Ben Williamson goes wide of the right-hand post.90:00 +0:37
Calvin Andrew is flagged offside by the assistant referee. Indirect free kick taken by Matt Fish.89:42
The ball is sent over by Myles Weston, Charlie Lee produces a left-footed shot from deep inside the penalty box which goes wide of the right-hand upright.88:55
The ball is delivered by Robert Taylor, Adam Barrett makes a clearance.88:23
Calvin Andrew gives away a free kick for an unfair challenge on Matt Fish. Stuart Nelson restarts play with the free kick.87:26
Robert Taylor decides to take the corner short.85:58
Free kick awarded for a foul by Steven Gregory on Doug Loft. Chris Neal restarts play with the free kick.82:26
Steven Gregory delivers the ball from the free kick right-footed from left wing, Ben Williamson makes a clearance.82:26 Booking
Booking Darren Purse goes into the book.82:06
Foul by Darren Purse on Adam Birchall, free kick awarded.80:17 Substitution
Substitution Ashley Vincent leaves the field to be replaced by Robert Taylor.79:58
Myles Weston produces a left-footed shot from outside the penalty box and misses left.79:44
Corner from the left by-line taken by Joe Martin, Adam Yates makes a clearance.79:16
The ball is delivered by Joe Martin, Charlie Lee takes a shot. Save made by Chris Neal.77:47
Ryan Burge takes the outswinging corner, clearance by Adam Barrett.75:40 Substitution
Substitution Jennison Myrie-Williams goes off and Calvin Andrew comes on.75:07
Foul by Tom Pope on Joe Martin, free kick awarded. Stuart Nelson restarts play with the free kick.74:32 Substitution
Substitution (Port Vale) makes a substitution, with Ben Williamson coming on for Lee Hughes.
Substitution Charlie Lee on for Chris Whelpdale.72:58
Corner from the left by-line taken by Joe Martin, Danny Kedwell takes a shot. Darren Purse gets a block in.69:29
Free kick awarded for a foul by Adam Barrett on Doug Loft. Chris Neal takes the free kick.69:05
Corner from right by-line taken by Chris Whelpdale.68:52
The ball is swung over by Danny Kedwell, clearance made by Darren Purse.65:06
Steven Gregory has an effort at goal from long range that goes wide left.63:39
Chris Neal takes the direct free kick.63:39 Substitution
Substitution Deon Burton leaves the field to be replaced by Adam Birchall.63:39 Substitution
Substitution (Gillingham) makes a substitution, with Steven Gregory coming on for Jack Payne.63:39
Deon Burton concedes a free kick for a foul on Darren Purse.60:44
Darren Purse fouled by Deon Burton, the ref awards a free kick. Direct free kick taken by Chris Neal.60:14
Lee Hughes concedes a free kick for a foul on Adam Barrett. Stuart Nelson takes the free kick.59:15
The offside flag is raised against Tom Pope. Free kick taken by Stuart Nelson.57:34
Corner taken by Chris Whelpdale from the right by-line, clearance made by Liam Chilvers.54:54
Shot by Lee Hughes from deep inside the penalty area misses to the right of the target.54:02
Tom Pope has an effort at goal from outside the area which goes wide right of the goal.53:20
Corner taken by Ryan Burge from the left by-line, Myles Weston makes a clearance.52:08
Ashley Vincent takes a inswinging corner.49:39
Ryan Burge takes a outswinging corner from the left by-line played to the near post, clearance made by Danny Kedwell.48:41
Jack Payne concedes a free kick for a foul on Doug Loft. Direct free kick taken by Darren Purse.46:09
Foul by Andy Frampton on Ryan Burge, free kick awarded. Direct free kick taken by Chris Neal.45:01
The match restarts for the second half.45:00 +3:06 Half time
Half Time The players leave the pitch at half time.45:00 +1:11
Deon Burton challenges Darren Purse unfairly and gives away a free kick. Chris Neal takes the free kick.44:54
Leon Legge fouled by Lee Hughes, the ref awards a free kick. Matt Fish restarts play with the free kick.43:20
Matt Fish produces a right-footed shot from outside the penalty box and misses right.41:22
Outswinging corner taken from the right by-line by Joe Martin.39:22
Effort on goal by Jennison Myrie-Williams from just outside the area goes harmlessly over the target.37:17
Stuart Nelson restarts play with the free kick.37:17 Booking
Booking Lee Hughes receives a caution for unsporting behaviour.36:58
Foul by Lee Hughes on Leon Legge, free kick awarded.35:52
The referee blows for offside. Free kick taken by Stuart Nelson.33:10
Free kick awarded for an unfair challenge on Joe Martin by Jennison Myrie-Williams. Chris Whelpdale restarts play with the free kick.32:00
Doug Loft takes a shot. Save by Stuart Nelson.28:40
Myles Weston produces a cross, Headed effort from deep inside the penalty area by Chris Whelpdale misses to the right of the target.27:32
Myles Weston takes a shot. Darren Purse gets a block in.26:59
The offside flag is raised against Lee Hughes. Free kick taken by Matt Fish.26:12
Jack Payne takes a shot from 35 yards and went wide of the right-hand post.24:38
Deon Burton challenges Doug Loft unfairly and gives away a free kick. Darren Purse restarts play with the free kick.21:51
Lee Hughes challenges Leon Legge unfairly and gives away a free kick. Direct free kick taken by Matt Fish.20:33 Goal scored
Goal! - Danny Kedwell - Gillingham 1 - 2 Port Vale Goal scored by Danny Kedwell from the edge of the penalty box to the bottom left corner of the goal. Gillingham 1-2 Port Vale.19:28 Goal scored
Goal! - Lee Hughes - Gillingham 0 - 2 Port Vale Lee Hughes grabs a headed goal from close in. Gillingham 0-2 Port Vale.18:25
Jennison Myrie-Williams fouled by Myles Weston, the ref awards a free kick. A cross is delivered by Ryan Burge, Tom Pope takes a shot. Save by Stuart Nelson.17:20
Corner taken right-footed by Chris Whelpdale, Headed effort from deep inside the penalty area by Leon Legge misses to the left of the goal.15:31
Joe Martin crosses the ball, Close range headed effort by Leon Legge misses to the right of the goal.15:06
Outswinging corner taken left-footed by Joe Martin from the left by-line, Darren Purse makes a clearance.14:49
Myles Weston takes a shot. Save by Chris Neal.14:09
Free kick awarded for an unfair challenge on Darren Purse by Deon Burton. Free kick taken by Darren Purse.13:32
Jack Payne has an effort at goal. Save by Chris Neal.12:38
Myles Weston crosses the ball, Liam Chilvers manages to make a clearance.11:44
Jennison Myrie-Williams is ruled offside. Indirect free kick taken by Stuart Nelson.10:51
Darren Purse fouled by Danny Kedwell, the ref awards a free kick. Free kick taken by Chris Neal.9:41
Headed effort from deep inside the penalty area by Danny Kedwell goes harmlessly over the crossbar.6:19
Joe Martin challenges Jennison Myrie-Williams unfairly and gives away a free kick. The free kick is swung in left-footed by Ryan Burge, clearance made by Adam Barrett.5:19
Myles Weston sends in a cross, Chris Neal makes a save.4:25
Shot from outside the penalty box by Jack Payne goes wide right of the goal.3:20
Assist on the goal came from Doug Loft.3:20 Goal scored
Goal! - Tom Pope - Gillingham 0 - 1 Port Vale Tom Pope finds the back of the net with a headed goal from inside the penalty box. Gillingham 0-1 Port Vale.3:07
A cross is delivered by Doug Loft,1:18
Matt Fish fouled by Ashley Vincent, the ref awards a free kick. Stuart Nelson restarts play with the free kick.0:13
Free kick awarded for a foul by Danny Kedwell on Ryan Burge. Free kick taken by Darren Purse.0:00
The ref blows the whistle to begin the match.
Live data and text provided by our data suppliers