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.
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.