Gillingham suffered their first home loss of the campaign as a 92nd minute re-taken penalty saw Shrewsbury snatch all three points at the MEMS Priestfield Stadium.
Town midfielder Nicky Wroe struck the killer blow sending keeper Ross Flitney the wrong way from the spot after his first effort, which had also found the net, was ruled out by referee Fred Graham following some encroachment.
Keeper Flitney proved to be the hero turned villain as he conceded the spot kick having previously made a number of good saves.
It wasn't as if the Gills didn't create at the other end, frustratingly they had a number of shots, but ultimately they also missed a penalty of their own in the 24th minute, Danny Kedwell seeing his effort saved.
Gills boss Andy Hessenthaler made two changes from the team beaten at Rotherham last Saturday, Danny Jackman took the left-back role from Joe Martin and Luke Rooney took Danny Spiller's midfield role.
Gillingham started off well and inside the first sixty seconds Charlie Lee had fired wide, so wide it went for a throw and Rooney went down in the area but referee Graham waved away the few appeals for a penalty.
Steve Allen, the Gills physio, was a busy man in the early stages as both Kedwell, a clash of heads with Ian Sharps, and Jack Payne, caught by Marvin Morgan, required treatment.
In between the two stoppages, Rooney fired a low, bouncing shot across the face of goal.
Then keeper Ben Smith was forced to hack clear as Lee closed him down after Barry Fuller's neat ball had set up Kedwell to cross low into the area.
Shrewsbury were a no nonsense side when it came to defending while at the other end Lionel Ainsworth was lively on the right flank with both Morgan and Terry Gornell working tirelessly.
In the 19th minute Flitney made the first of his good saves keeping out a downward header from Shane Cansdell-Sherriff and was thankful as Morgan fired the loose ball over from close range.
Then came the Gills best chance, a great reverse pass from Lewis Montrose sent Rooney into the area where he was tripped by Jermaine Grandison and the official pointed straight to the spot.
Kedwell, the two-goal spot-kick hero in the previous home game against Plymouth, unfortunately saw Smith guess right, dive right and blocked the striker's effort with his body.
The Shropshire outfit were certainly quick on the break but man-of-the-match Matt Lawrence and birthday boy Andy Frampton managed to keep them at bay, Wroe curling their best effort inches wide.
Hess was forced into substitution two minutes from half-time when Jack Payne was unable to continue, in the reshuffle the Gills adopted a 4-4-2 formation with Dennis Oli coming on.
Morgan almost gave the Shrews the lead within seconds of the restart but once again Flitney got down to turn the former Aldershot striker's effort round the post.
Just moments later Kedwell looked to get on the end of a ball over the top but just as he looked to shoot, Cansdell-Sherriff got in a terrific last ditch tackle.
Flitney pulled off another great save low to his right keeping out a Wroe strike before Lawrence blocked a Morgan shot.
At the other end Rooney twice hit shots from distance straight at Smith, Kedwell fired wide, Montrose also found the Shrews keeper with a long-range attempt. while Lee fired over the top.
Mark Wright and Wroe fizzed shots over while Fuller executed a great tackle on Morgan as he looked to get a shot in.
As the frustrations grew both on and off the pitch, Lee picked up his third booking of the season for a rash challenge on Joe Jacobsen
With Chris Whelpdale and Martin having been introduced during the second-half, the Gills cause wasn't helped when youngster Rooney went down with a severe case of cramp and was reduced to almost a walking role in the closing stages.
Gornell had a strike well saved again by Flitney and it looked as if both teams would take a point as the minutes ticked by.
Then deep into stoppage time Graham Turner's side struck the killer blow.
Former Accrington Stanley forward Gornell was able to send Sean McAllister into the area and Flitney sent the diminutive midfielder crashing to the Priestfield turf, once again Mr Graham had little option but to point to the spot.
There was hope for the Gills when Wroe saw his first effort, slotted straight down the middle, ruled out for encroachment by the referee but the midfielder kept his nerve to send Flitney the wrong way with his second effort to secure victory for the Shrews.
I don't think the Gills deserved to lose overall and the League Two table see's Andy Hessenthaler's men lying sixth a point behind the Shrews who have jumped up to fifth from eleventh.
Gillingham: Flitney, Fuller, Lawrence, Frampton, Jackman, J.Payne (Oli 43), Rooney, Lee, Montrose (Martin 70), Weston (Whelpdale 59), Kedwell
Subs: Richards, Gazzaniga
Shrewsbury Town: Smith, Grandison, Jacobson, McAllister, Sharps, Cansdell-Sherriff, Wright, Wroe, Morgan, Ainsworth, Gornell
Subs: Neal, Leslie, Hazell, M.Richards, Goldson
Attendance: 4869 (168 Shrews fans)
Referee: Fred Graham
Assistants: Antony Coggins and Harry Lennard
Fourth Official: Michael George