A remarkable second-half transformation sparked by the former Castleford half-back Danny Orr saw Harlequins through to the fifth round of the Challenge Cup. Trailing by 14 points at half-time, Quins found inspiration when Orr set up a try and scored another to put them in command.
After a start interrupted by repairs to a touch judge's walkie-talkie, only a last-ditch tackle from Michael Shenton stopped Quins' Rob Purdham on the line. Tony Clubb was also close from Henry Paul's kick but Castleford's defence was determined.
It took a 40-20 kick from Brent Sherwin to put Castleford in a promising attacking position. They took maximum advantage, Antony Thackeray kicking through and Shenton winning the race for the ball.
Rikki Sheriffe nearly got in at the corner for the hosts but Cas extended their lead when Craig Huby, who had earlier landed a conversion, kicked a penalty after Paul was penalised for holding down in the tackle. The Tigers were looking anything but the worst side in Super League and slick passing set up a second try, for Adam Fletcher.
Kirk Dixon, kicking in place of the injured Huby, missed a conversion, but he completed a good first 40 minutes for the visitors with a penalty when Gareth Haggerty stole the ball.
Quins came back into the contest straight after the interval, Paul sending Michael Worrincy through a huge gap. Suddenly the complexion of the game changed and Chad Randall dummied over at the foot of the posts, Purdham adding a second goal.
Quins drew level with a Purdham penalty and took the lead through Orr's cross-kick, Clubb out-jumping Fletcher to touch down. Orr's elusive run then put Quins in a comfortable position.
Two defenders then got under Randall's high kick, deflecting it into David Howell's arms for another Quins try. Haggerty got over and Danny Ward completed the rout in the last minute.
Harlequins: Wells; Clubb, Gafa, Howell, Sheriffe; Paul, Orr; Temata, Randall, Ward, Mbu, Worrincy, Purdham. Substitutes used: Rinaldi, Haggerty, Melling, Grayshon.
Castleford: Donlan; Fletcher, Dixon, Shenton, Wainwright; Thackeray, Sherwin; Higgins, Henderson, Korkidas, Huby, Clayton, Lupton. Substitutes used: Moore, Boyle, McGoldrick, Haberecht.
Referee: R Silverwood (Mirfield).