Caid Du Berlais finished with a flourish to deny Johns Spirit back-to-back Paddy Power Gold Cup wins at Cheltenham.
Jonjo O'Neill's seven-year-old looked to have done everything right under Richie McLernon and went clear after jumping the last well.
However, Sam Twiston-Davies conjured a tremendous run out of the 10-1 winner to land the first major handicap of the season by a head.
"I've got a lot of apologising to do as I told Paul not to run him, but he travelled and jumped - we rode him very differently," said Twiston-Davies.
"We just let him jump away, but it was impossible to get closer without expending too much energy by going wide. In fairness he really picked up after the last.
"It's only his fourth run over fences. It's a brilliant training performance."
Present View, the 5-1 favourite, was third and Oscar Whisky finished fourth at 6-1.
A number of layers were paying five places in the feature at Cheltenham, with Buywise (7-1) filling the bonus place.
In the testing conditions, the pace, set by Present View, was not strong.
There were plenty in with chances coming down the hill, but the market leader still appeared to be going as well as anything.
Everything changed after the second-last, when Johns Spirit loomed up and took over approaching the final fence, looking set for the history books.
Caid Du Berlais (10-1) found another gear, though, to deny Johns Spirit a rare double with a withering late run.
Earlier on the card, Nicholls and Twiston-Davies struck with Sam Winner (15-2) in the Murphy Group Handicap Chase.
"He nearly didn't run, so that's fantastic," said Nicholls.
"Sam rode him brilliantly, he just kept on the outside and followed Richie.
"I put a tongue tie on as I thought soft ground had stopped him before.
"When they are well things like this happen, I thought he had a chance at the last. The plan was very much about today - this was his Gold Cup.
"Sam's won with two different rides today that were top-drawer. He's a good young man, he doesn't panic and he's improving all the time.
"As I've said before, it's an investment for the future. This was a big day for Sam and I'm really pleased with him. He has done exactly what we asked him to.
"We'll see where we go from here but I'm just happy it all came together today."
He added: "I've not been worried about the stable form earlier this year. This is when you want them to come right - not in October. Most of the horses I've been running weren't entitled to win anyway."
Twiston-Davies said: "This is what it's all about.
"I've got a lot of apologising to do as I told Paul not to run him, but he travelled and jumped - we rode him very differently.
"We just let him jump away, but it was impossible to get closer without expending too much energy by going wide. In fairness he really picked up after the last.
"It's only his fourth run over fences. It's a brilliant training performance."
The jockey revealed he had read criticism of himself and said: "When people want to moan or be rude about me, it makes me more willing to prove them wrong."
Johns Spirit got a terrific reception himself and trainer Jonjo O'Neill said: "He did everything right and it was just the weight that beat him. That's Cheltenham. He ran a blinder. We'll just get him home now and make a plan."
Present View’s trainer Jamie Snowden said: "He ran brilliantly, it was just the ground. It just blunted his natural enthusiasm."
The Nicky Henderson-trained Oscar Whisky said: "Barry (Geraghty) says go for the Ryanair Chase and now all we need to do is plan how to get there. He'll certainly come on for this run."
Twiston-Davies' confidence had clearly been buoyed by the performance of top weight Sam Winner.
The former classy hurdler lost his pitch at one point and looked like he was not going to take much interest, but Twiston-Davies persevered and it paid off as he galloped up the final hill to thwart 4-1 favourite The Druids Nephew by a length and a half.
Nicholls said: "He never jumped on the first circuit and nearly dropped himself out, which he did over hurdles, but I told Sam not to give up on him. He can be idle, but I thought that was as good a ride as you'll see.
"I had a big decision to make as I thought he'd run a big race in the Hennessy, but the owners wanted to run here.
"It would be hard to go for the Hennessy now, and I have Rocky Creek and a couple of others for that. He's a National horse, without a shadow of a doubt.
"How we get there I don't know. You could stick him in the Lexus (at Leopardstown), he just might be suited by going in a small-field conditions chase somewhere."
Kapga De Cerisy was injured as he unseated his rider four out. He was humanely put down after assessment from vets.