A 95th minute winner by Jack Grimmer ended the Owls’ involvement in the competition after the Championship side had twice surrendered the lead.
Going out of the Cup was harsh on Carlos Carvalhal’s men, especially as they had led with just three minutes remaining.
But, in the end, there was no stopping the League One side booking a place in the last 16 for the first time in more than 20 years.
It meant a wretched end to the day for Wednesday and their 1,503 travelling fans, who had arrived at the Greenhous Meadow to suggestions a breakthrough has been made in the Yorkshire club’s pursuit of Aidan McGeady.
The Irishman has been told he can leave Everton, leaving the Owls free to speak to the wideman.
That had looked like being the prelude to a routine Wednesday win, not least in a first half that was as low key as the final moments were dramatic.
On a bitterly cold afternoon in Shropshire, Wednesday gave their travelling fans some warm cheer on 19 minutes.
A clumsy foul on Marco Matias handed the Owls a free-kick, wide on the left, and McGugan curled an exquisite delivery that left goalkeeper Jayson Leutwiler in two minds as to whether anyone would get a touch or not.
In the end, no-one managed to reach the ball and it sailed past the Shrews goalkeeper and into the net.
Matias came close to doubling the visitors’ advantage two minutes before the interval but, this time, Leutwiler was able to save.
Otherwise, chances were at a premium in an opening 45 minutes that saw Wednesday dominate possession.
Andy Mangan did have a sight of goal but a fine tackle by Jose Semedo snuffed out the opening to send the visitors in ahead at the interval.
Lewis Price finally had an on target effort to deal with four minutes into the second half but Larnell Cole’s shot was straight at the Owls goalkeeper.
Jack Grimmer also fired straight at Price but the visitors failed to heed the warning and M icky Mellon’s side equalised on 56 minutes.
Vincent Sasso was caught out by the pace of Andy Mangan, who then delayed his sufficiently to allow Jean-Louis Akpa-Akpro to get forward and head in the exquisite delivered ball.
Price denied the now confident hosts a second goal just after the hour with a smart to save to keep out Akpa-Akpro after the striker had been played clear by Ian Black.
It was a let-off that the Owls capitalised on 16 minutes from time when McGugan drilled in his second of the afternoon.
That should have been that but there was late drama as Sasso brought down Akpa-Akpro in the penalty area. He got up and took the spotkick himself, which Price saved only for Shaun Whalley to fire in the rebound.
Wednesday had a huge appeal for a penalty when Atdhe Nuhiu looked to be fouled in the box but nothing was given and Shrewsbury raced up the other end to secure a dramatic victory when Scott Vernon crossed for Grimmer to net the winner.
Carvalhal said: “Congratulations to Shrewsbury.
“They have done well to get through to next round, but I am disappointed with the crucial decision not to give us a penalty at the end of the game.
“We did everything we could to get to the next round, and I will make no excuses, but our priority is the Championship.
“We will now fight 100 per cent to focus on doing well in the league.
“It was also good for us to have players back in this game, as they can help us more in the second half of the season.”