Scott Hale scored two late tries to help book Dewsbury’s place in the fifth round after a bruising encounter with Newcastle Thunder.
The Rams took a 10-0 lead through tries for Tom Hemingway and Dalton Grant, Hemingway converting one.
But Thunder levelled matters as substitute Paul Stamp and Tom Capper replied with tries for the visitors.
Thunder went ahead on 43 minutes thanks to a Hardcastle penalty, but Aaron Brown responded for the Rams on 50 minutes and Hale touched down 14 minutes later.
Thunder’s Hardcastle converted his own try to make it 22-18 with eight minutes to go, but Dewsbury finally saw off their League One opponents when Hale stretched over with five minutes left.