Match ends, Rochdale 1, Sheffield Wednesday 2.
Oguchi Onyewu's first goal for 10-man Sheffield Wednesday secured victory over League Two Rochdale and a place in the fifth round of the FA Cup.
Joe Mattock, later sent-off for a second bookable offence, gave the Championship side the lead before Onyewu smashed home minutes later.
Rochdale captain Michael Rose rekindled home hopes with a 25-yard strike.
But despite being down to 10 men, Wednesday held on to reach the last 16 for the first time since 2011.
Caretaker boss Stuart Gray was handed a two-and-a-half year contract after watching only Wednesday's second away win of the season.
Gray, whose side are now unbeaten in eight, punched the air on the final whistle after seeing his team display the kind of battling qualities which resulted in Owls chairman Milan Mandaric offering him the permanent position.
Dale, who beat Leeds in round three, will reap the financial rewards that come with a crowd of more than 8,000.
Second in the league table, they will now be able to concentrate on securing promotion to the third tier of English football.
There was an air of expectancy amongst the home supporters at a rain-sodden Spotland as they welcomed a side battling to survive in the Championship, but 12 ruthless minutes at the start of the second half dashed their hopes.
American Onyewu, playing in only his second game for Wednesday since leaving Queens Park Rangers - for whom he did not play a single game - headed against the post late in the first-half as corners and free-kicks caused havoc.
And it was from another whipped delivery that the Owls took the lead on 50 minutes, Mattock tapping home a near-post flick-on.
Wednesday's travelling support of more than 3,000 were soon celebrating again when former Sporting Lisbon and Standard Liege defender Onyewu, 31, pounced from six yards to lash the ball low into the net.
The Championship side's clinical start to the second half drew focus on Dale's wasted opening in the first period, when Matt Done fired against the legs of visiting keeper Damian Martinez from 10 yards.
Done's midfield counterpart and captain Rose reduced the arrears in spectacular fashion from long range before his free-kick was well tipped over by Martinez.
Mattock saw red for a trip on Ian Henderson as home pressure built but Dale, unbeaten in four before kick-off, relied on a succession of crosses late on and could not carve out a meaningful opening as three-time FA Cup winners Wednesday progressed.
Rochdale manager Keith Hill:
"They scored from two set plays and we responded well and got the goal back but when they went down to 10 men it made it really difficult.
"They defended superbly against our extra man. The players can hold their heads high and we haven't let anyone down.
"We've got 19 real cup finals and there's magic in every one of those games for us because we can really achieve something this season."
Sheffield Wednesday head coach Stuart Gray:
"I asked the foreign lads at the team meeting what they thought about the FA Cup and now they'll realise. The atmosphere was fantastic, it was a typical FA Cup tie.
"There was a gale-force wind against us in the first half and we had to defend well and we did. It's just hard work, effort and commitment but all of the players deserve the credit for the effort they've been putting in.
"I would love a home draw against a big team because the fans deserve that and it would be a great atmosphere at Hillsborough."
- 3BennettSubstituted forCampsat 75'minutes
- 24AllenSubstituted forDonnellyat 59'minutes
- 5EasthamBooked at 6mins
- 7VincentiSubstituted forCumminsat 67'minutes
- 25RoseBooked at 85mins
- 12LundBooked at 20mins
- 19MattockBooked at 64mins
- 6SemedoBooked at 55mins
- 25LaverySubstituted forHelanat 67'minutes
- 34NuhiuSubstituted forJohnsonat 78'minutes
- 10MaghomaSubstituted forCokeat 82'minutes
- Simon Hooper
- Shots on Target
Second Half ends, Rochdale 1, Sheffield Wednesday 2.
Attempt blocked. Jermaine Johnson (Sheffield Wednesday) right footed shot from outside the box is blocked.
Attempt missed. Graham Cummins (Rochdale) right footed shot from outside the box is close, but misses to the right.
Corner, Sheffield Wednesday. Conceded by Matt Done.
Attempt blocked. Chris Maguire (Sheffield Wednesday) right footed shot from outside the box is blocked.
Attempt saved. Scott Hogan (Rochdale) right footed shot from the left side of the box is saved in the top centre of the goal.
Attempt saved. Chris Maguire (Sheffield Wednesday) right footed shot from outside the box is saved in the bottom right corner.
Michael Rose (Rochdale) is shown the yellow card.
Jeremy Helan (Sheffield Wednesday) wins a free kick in the defensive half.
Foul by Michael Rose (Rochdale).
Substitution, Sheffield Wednesday. Giles Coke replaces Jacques Maghoma.
Foul by Callum Camps (Rochdale).
Jermaine Johnson (Sheffield Wednesday) wins a free kick on the right wing.
Substitution, Sheffield Wednesday. Jermaine Johnson replaces Atdhe Nuhiu.
Attempt missed. Matthew Lund (Rochdale) right footed shot from outside the box misses to the right.
Substitution, Rochdale. Callum Camps replaces Rhys Bennett.
Corner, Sheffield Wednesday. Conceded by Ashley Eastham.
Michael Rose (Rochdale) wins a free kick in the defensive half.
Foul by Chris Maguire (Sheffield Wednesday).