Nicky Wroe's last-minute penalty gave Shrewsbury all three points against promotion rivals Gillingham.
Wroe coolly slotted home after Sean McAllister was clumsily fouled by Gills keeper Ross Flitney.
The hosts missed a penalty when Danny Kewell hit a weak attempt straight at Ben Smith after Luke Rooney was fouled by Jermaine Grandison.
The margin of victory could have been greater had Marvin Morgan not blazed over from just three yards out.
VIEWS FROM THE DRESSING ROOM
Gillingham manager Andy Hessenthaler told BBC Radio Kent:
"We got what we deserved, we deserved to lose. It's cruel it comes at the end but I don't think we were at it from start to finish and the boys were told that today.
"As a group, we've got to do better, good teams bounce back, we're a good team but not today. Shrewsbury deserved to win the game.
"We weren't good enough, I'm only telling you what I've told the players."