Ivan Cavaleiro spared Wolves' blushes after firing them into the FA Cup fifth round to break Shrewsbury's hearts.
The forward struck to beat the battling Shrews 3-2 and settle an absorbing replay at Molineux.
James Bolton's header and Josh Laurent's strike, after John Ruddy's error, had put the Sky Bet League One side 2-1 ahead.
Matt Doherty continued to taunt Shrewsbury, though, scoring twice in the first half having netted a late equaliser in the first fourth-round tie.
Separated by 60 places, the visitors again threatened an upset having led 2-0 at New Meadow before the 2-2 draw last month.
But Cavaleiro's fourth goal of the season booked Wolves a trip to Bristol City, just the second time they have reached the fifth round in the last 10 seasons.
It took the hosts just 78 seconds to open the scoring as they cashed in on sloppy Shrewsbury defending.
https://twitter.com/Wolves/status/1092910310682517506
Morgan Gibbs-White's corner was returned to him and his delivery saw Romain Saiss get a touch before Doherty fired in from six yards.
It appeared to ease any nerves after Wolves' near miss in Shropshire – but after 11 minutes Shrewsbury stunned Molineux.
Alex Gilliead won a corner, the visitors' first, and when Ollie Norburn swung it in Bolton escaped to power in a header from five yards.
Wolves quickly regrouped and began to dominate and Luke Waterfall deflected Jonny's volley behind before Willy Boly miscued a free header after 27 minutes.
But they were wasteful, Adama Traore the main culprit, repeatedly getting into fine positions without making it count.
And the hosts were made to pay six minutes before the break after Ruddy's howler.
The visitors had been under pressure but escaped to hound Wolves in their own half and when they won the ball back Laurent pounced.
Even so, his low drive from 18 yards should not have beaten Ruddy but it slipped through the goalkeeper's hands to spin over the line.
However, Wolves benefited from another goalkeeping gaffe to level in the sixth minute of first-half added time when Steve Arnold dropped Jonny's deep cross and Doherty nodded in his second from close range.
The goal wrestled the momentum back for the hosts and they bossed the second half, even before Cavaleiro's 62nd-minute winner.
The forward, who has started just eight times this season, collected Doherty's pass, rolled Waterfall and prodded under the advancing Arnold.
With Shrewsbury's belief gone Wolves relaxed and Raul Jimenez was denied a fourth by Arnold with 10 minutes left.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Nick Mashiter, Press Association Sport');
ga('pacontentapi.set', 'dimension2', '2250d0cf-c43b-4472-8502-bf81b63c51f6');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:club-news,paservice:sport:football,paservice:sport:match-reports,paservice:sport:uk,paservice:sport:world');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Doherty at the double as Wolves tame Shrews in FA Cup replay'});