The Tigers’ hard-fought victory means they will finish top of the table for the first time in the club’s history if current leaders St Helens lose at Huddersfield and they beat Catalan Dragons in Perpignan next weekend.
Castleford could do no wrong for the first half-hour as they stormed into a 22-0 lead but veteran forward Ali Lauitiiti inspired a remarkable fightback for the visitors.
Three-quarters Lee Gilmour and Richard Owen, both playing on loan from Castleford, scored tries against their parent club to help set up a tense finish before the Tigers were able to finally complete a third win of the season over their near neighbours.
Forward Brett Ferres scored the try that broke Hull FC as the Huddersfield Giants extended their unbeaten run in the First Utility Super League to six matches with a thrilling comeback.
Ferres dived over in the left corner in a spell of three tries in eight second-half minutes that turned the game on its head and ultimately secured a 38-28 victory for the hosts.
Hull led 18-4 inside half an hour but Jodie Broughton cut the arrears to 22-20 with a converted score in the 54th minute. Ferres put Huddersfield in front for the first time and they never looked back as their quest for a top-four finish received a further boost.
Prop Anthony Mullally and in-form Jermaine McGillvary, who has now scored eight tries in his last six outings, added gloss to the score.
Stefan Marsh claimed a second half hat-trick as Widnes ensured their place in the play-offs with a 32-12 victory at Bradford Bulls in a match which marked the end of top-flight rugby at Odsal.
The Vikings, needing just a point to move out of reach of pre-match rivals Hull KR and Wakefield, outscored the Bulls seven tries to two with winger Paddy Flynn adding two more touchdowns and both Patrick Ah Van and Lloyd White notching one apiece.
The success came after they rallied from 12-8 down at half-time and means Widnes will now contest play-off rugby for the first time.
Hull KR’s already slim play-off hopes were extinguished with a 32-14 defeat at home to Catalan Dragons, who recorded just their fourth away victory of the season.
Catalan deserved the win with a solid performance against a Rovers side that ran out of steam as the went on.
Their top-eight hopes were all but over after a performance against Hull last week that coach Chris Chester described as “embarrassing”, and this loss just confirmed the inevitable.
Read a full round-up of all the weekend’s rugby league action in Sports Monday supplement in The Yorkshire Post.