Justin Herbert did everything except line up in the victory formation.

Oregon’s local hero looked like a legitimate Heisman Trophy candidate and future first-round NFL draft pick on the national stage, completing 25 of 27 passes for 331 yards with one touchdowns and no interceptions.

But that was in regulation.

The Ducks, thanks to two costly second-half gaffes, snatched an agonizing defeat from the jaws of what would have been a signature victory for first-year coach Mario Cristobal.

No. 20 Oregon was outscored 31-7 after halftime and coughed up a 10-point lead in the final four minutes of regulation during a 38-31 overtime defeat to No. 7 Stanford in front of a stunned crowd of 58,453 on Saturday night at Autzen Stadium.

“We did everything we could to just give Stanford the game,” Herbert said. “Unfortunately things didn’t turn out the way we wanted them to. But we’re going to stick together and we’re not letting it divide us.”

K.J. Costello threw a 23-yard touchdown pass to tight end Colby Parkinson, who deftly tipped the ball to himself at the goal line, for the decisive score.

 

Herbert had four incompletions in overtime and was intercepted by senior cornerback Alameen Murphy in the end zone on fourth-and-goal to end the game.

“I think the defense played well, up until it was time when it mattered,” said nose guard Jordon Scott, who helped Jim Leavitt’s defense hold 2017 Heisman runner-up Bryce Love to 89 net yards rushing. “We let the team down in a big way tonight.”

CJ Verdell feels the same way. The redshirt freshman running back had a chance to ice the game for Oregon in regulation but lost a fumble reaching for a first down at the Stanford 40-yard line with 51 seconds left.

Costello completed three consecutive passes totaling 41 yards to get the Cardinal in position for the tying field goal.

After Oregon was penalized five yards for having 12 men on the field, Jet Toner calmly booted a 32-yard try to tie the score 31-31 as time expired in regulation.

Cristobal was asked three times why he decided to run Verdell on second-and-2 instead of having Herbert kneel on the ball.

“We want to be aggressive,” Cristobal said. “In our eyes, when our offensive line is playing like it did against them and knocking people off the ball, you trust your guys to get it done. A lot of things could go a lot of different ways, and it’s easy to second-guess after.”

Earlier in the wild seesaw affair, Stanford was on the verge of seizing control with a methodical fourth-quarter scoring drive.

But on fourth-and-inches at the Oregon 30-yard line, senior running back Cameron Scarlett was stopped by Drayton Carlberg and a mountain of Ducks.

Herbert then marched Oregon on an 11-play, 70-yard drive that included an 8-yard completion to Brenden Schooler on third-and-5 and a 16-yard completion to Dillon Mitchell on fourth-and-1.

Cyrus Habibi-Likio’s 1-yard touchdown plunge gave the Ducks a seemingly safe 31-21 lead with 4:39 remaining in regulation.

“That fourth-and-1 stop was huge for us as a defense, but momentum goes both ways, here and there,” Carlberg said. "At the end of the night, we didn’t get it done.”

Costello completed a 49-yard pass to Osiris St. Brown and a 15-yard touchdown to J.J. Arceda-Whiteside to get the Cardinal within three points with 3:10 left.

Safety Noah Williams forced Verdell’s fumble, and linebacker Sean Barton recovered the ball to give the Cardinal life.

“That’s a really tough deal for him. I love CJ and our players like my very own son. OK, so I want to make sure that’s absolutely clear, and I told him that in the locker room,” Cristobal said. “Yes he’s going to beat himself up, and competitors will do that, especially in moments like this, especially as hard as he was running."

The Ducks thought they were about to take a 31-7 lead when Jaylon Redd scored on a reverse. After a video review, the officials ruled that Redd’s foot touched the pylon before the ball crossed the goal-line, which gave Oregon a first-and-goal at the 1-yard line.

Habibi-Likio, who had scored four touchdowns on five carries during nonconference play, fumbled on the next snap for a loss of nine yards.

Then center Jake Hanson’s high snap to Herbert was scooped up by senior linebacker Joey Alfieri for an 80-yard touchdown to get Stanford within 24-14.

“Jake is pretty consistent with his snaps but that one, it looked like it was high and went off of Justin’s hands,” Cristobal said. “Obviously that switched the momentum, it got things going that way.”

The Ducks scored on all four of their first-half possessions but ultimately let a 24-7 lead slip away, despite getting 346 yards passing from Herbert and 178 yards rushing, led by Verdell's 115 yards.

Cristobal said it will be important to make sure Stanford doesn't beat his team twice.

Oregon plays at California next Saturday, where Herbert threw six touchdowns in his first road start in 2016 and still left the field in tears after a double-overtime loss.

"We’re not going to let that define us and we’ll be back at it this week," Herbert said.