Colin Daniel's stoppage-time strike has propelled Port Vale into eighth in League One after beating struggling Gillingham.
Vale started well, with Louis Dodds and Mark Marshall both going close to netting an early opener for the hosts.
However, Rob Page's men edged in front in the 11th minute when Carl Dickinson's pinpoint cross reached Ben Williamson, who turned the ball past Gills keeper Stuart Nelson.
Andy Hessenthaler's side fought back late in the first half as Brennan Dickenson saw his shot saved and Joe Martin fired narrowly wide.
The visitors then levelled after Port Vale continued to squander possession, and Bradley Dack's incisive run and cross presented Cody McDonald with the perfect opportunity to net his third goal in four games.
Dack then thought he had found a crucial second goal, but his effort struck the Vale crossbar on 63 minutes.
The Gills looked like they would be leaving Vale Park with a draw, but the home side sealed a dramatic victory when Marshall crossed for Daniel, and the substitute tucked his shot home in the third minute of added time to give Port Vale three points.
No Data Analysis info