Castleford winger James Clare helped himself to four tries, but still ended up on the losing side in a final day Super League local derby thriller against Wakefield at Belle Vue.
Liam Kay's last-minute try, his third of the afternoon, snatched 11th place for Wakefield, who finished just above their West Yorkshire neighbours.
Frankie Mariano (2) and Kyle Trout also crossed for victorious Trinity.
But Salford-bound Rangi Chase ran in a try on his farewell appearance for Cas.
The result was perhaps harsh on the visitors, who took the lead when Clare stripped the Wildcats' defence to race the length of the field and score.
After a Peter Fox error, they then extended their lead when the dancing Chase darted in, Kirk Dixon converting from out wide for a 10-0 lead.
Wakefield's response was immediate, Paul Aiton sending through Matty Wildie, who picked out the supporting Mariano, Ben Cockayne tagging the goal.
Cas were soon in again as another Fox lapse allowed Chase to put Clare in, but close-range tries from Kay and Mariano maintained the see-saw nature of the contest.
Cockayne and Hauraki then spent 10 minutes on the sidelines for a bust-up, before smart work from Jordan Tansey sent Clare in for a third time.
However, Richie Mathers responded by classily slipping in Trout and, when Kay cashed in some neat work from Cockayne, Lauitiiti and Mariano, Wakefield looked to be coasting.
But tries from Hauraki and a fourth for Clare gave Cas back the lead, Dixon's fourth goal of the afternoon making it 32-28.
Ben Reynolds would have added to that, had it not been for a crunching hit from Justin Poore.
Instead, Lauitiiti's try squared things up at 32-32, Smith missing with the conversion attempt.
But then, on his last play for Castleford, Chase tried a creative kick ahead which Lauitiiti shovelled up before feeding stand-off Kay, who brought the house down.
VIEWS FROM THE DRESSING ROOM
Wakefield head coach Richard Agar:
"Liam Kay took his tries exceptionally well. During the course of the game I thought we were the team who were consistently making line breaks.
"We have had a really tough week. We will try and keep a hold of the core group of players. The club has got some important bills and situations over the next two months.
"We probably have to sell at least one more player, maybe even two. We may lose three, four, five or maybe more.
"Danny Kirmond I feel is an untouchable one though. He is a Wakefield kid. The chairman has made it clear that we want him to lead us out in a new stadium."
Castleford coach Daryl Powell:
"It is a little bit of a bitter-sweet finish but I just said to the players it's been a pleasure over the last 13 games. The young guys did themselves and the club proud.
"I've been really pleased with the second half of the season since I've been involved - we've got to build on that now.
"Rangi [Chase] is a special player. He's a once-in-a-lifetime sort of player. I haven't seen anybody else do the type of things he's done.
"I think he's really loved being at Castleford and that's good to see. Since I've been at the club he's been nothing but a pleasure to work with and every Castleford fan will say it's been a pleasure to have him at the club."
Wakefield: Mathers; Fox, Collis, Mariano, Cockayne; Kay, Wildie; Poore, Aiton, Amor, Kirmond, Walshaw, Trout.
Replacements: Lauitiiti, Wilkes, Raleigh, Smith.
Castleford: Tansey; Owen, Channing, Dixon, Clare; Chase, Ellis; Boyle, Milner, Huby, Massey, Hauraki, Clark.
Replacements: Thompson, Fleming, Martin, Reynolds.
Referee: Rob Hicks (Oldham).