By ANNE M. PETERSON / AP Sports Writer

CORVALLIS, Ore. — There was no reason for any doubt when Jet Toner stepped up to kick the game-winning field goal for Stanford on Saturday night.

“He’s got that cool Hawaiian breeze going through his veins,” Cardinal coach Davis Shaw said about the senior from Honolulu.

Toner’s 39-yard field goal came with just a second left on the clock, and Stanford overcame Oregon State’s late rally for a 31-28 victory that snapped a three-game losing streak.

The Beavers tied the game at 28 on Artavis Pierce’s 1-yard touchdown run with 1:55 left in the game. But Connor Wedington returned the kickoff 43 yards and Davis Mills passed for a first down and ran for another on a final drive that ended with Toner’s field goal.

Mills, starting in place of injured quarterback K.J. Costello, threw for 245 yards and three touchdowns for the Cardinal (2-3, 1-2 Pac-12), who extended their winning streak over the Beavers to 10 games. Costello sat out of the game after injuring his thumb in Stanford’s loss to No. 13 Oregon last Saturday.

“It was huge,” Shaw said about the win. “First and foremost because it was a conference win. Tonight was the great team win that you’re looking for.”

The game, which was delayed for 15 minutes because of lightning in the area, was the Pac-12 opener for the Beavers (1-3, 0-1). Oregon State had a bye last weekend after a 45-7 victory over lower-tier Cal Poly two weeks ago.

Jake Luton threw for 337 yards and a touchdown for the Beavers. Isaiah Hodgins had 10 catches for 162 yards and a TD. Hodgins went into the game ranked eighth nationally with an average of 115.7 receiving yards a game.

The Cardinal led 28-14 in the fourth quarter, but B.J. Baylor’s 1-yard touchdown run closed the gap with 7:01 left and gave the Beavers momentum. But in the end the rally fell short.

“It’s real tough,” said Pierce, who finished with 141 yards rushing. “I feel like it’s part of us growing as a team, learning how to win those close games. It’s going to involve some growing pains like this. But I feel like will pay off in the end. We just got to keep fighting, stay together and put together a full game instead of one half.”

Stanford’s opening drive ended when Toner missed a 53-yard field goal attempt. Oregon State’s ensuing drive ended with Jordan Choukair’s missed 50-yard try. The Cardinal took over and capped its drive with Mills’ 22-yard touchdown pass to Michael Wilson.

Choukair’s 33-yard field goal attempt was blocked by Stanford midway through the second quarter.

Mills found Colby Parkinson with a 2-yard touchdown pass late in the half to take a 14-0 lead. The 6-foot-7 Parkinson was critical to Stanford’s victory over Oregon State last year with four touchdown receptions. In total, Parkinson caught six passes for 166 yards in the 48-17 win.

The Beavers got to the Stanford 25 before the break, but Luton was sacked twice, once for 15 yards and again for 5 yards, before time ran out.

Mills connected with Brysen Tremayne on a 3-yard touchdown to extend the lead midway through the third quarter before Luton’s 11-yard scoring pass to Hodgins, who barely got a hand on the ball while swarmed by three defenders.

Pierce made it interesting with a 43-yard touchdown run for Oregon State with 12:23 left in the game, closing within 21-14.

Stanford appeared to get a 46-yard field goal from Toner, but the Beavers were penalized on the play, negating the kick and giving the Cardinal a first down. A roughing the passer foul on Oregon State gave Stanford another first down and Parkinson found a leaping Mills with an 8-yard scoring pass.

“I was very excited and very nervous,” Parkinson said about the play.

UP NEXT: Stanford hosts Washington on Saturday.