Wolves were pushed all the way in their FA Cup fifth round replay at Molineux by a Shrewsbury side managed by former Wanderers defender Sam Ricketts.
After winning three Premier League games in-a-row heading into their replay, Nuno Espirito Santo named a strong side that eventually ran out 3-2 winners to set up a fifth-round tie at Bristol City.
Matt Doherty struck early on for the hosts before Shrewsbury hit back to take the lead through James Bolton and a Josh Laurent effort which Wolves goalkeeper John Ruddy should have kept out.
Another Doherty goal deep in first-half stoppage time levelled the tie, with progression assured by Ivan Cavaleiro's second-half strike.
Brentford progressed thanks to their 3-1 replay win over non-league Barnet.
The Championship side were in control at the interval after goals from Sergi Canos and Julian Jeanvier, with in-form Neal Maupay adding a third before David Tutonda scored a late consolation as Brentford progressed to face Swansea.
Watford will host QPR after Steve McClaren's Hoops overcame League One promotion-hopefuls Portsmouth at Loftus Road.
Darnell Furlong headed against the crossbar in a forgettable first half but a 2-0 win was sewn up as Nakhi Wells and Matt Smith scored in a seven-minute spell to secure a trip to Vicarage Road.