Sheffield Wednesday's 10 men held on for a 2-1 victory against plucky Rochdale at Spotland to reach the fifth round of the FA Cup.