Stanford running back Stepfan Taylor (33) dives over Oregon State safety Anthony Watkins (3) during the fourth quarter of an NCAA college football game in Stanford, Calif., Saturday, Nov. 10, 2012. Stanford won 27-23. (AP Photo/Jeff Chiu)

Photo: Jeff Chiu, Associated Press

Stanford running back Stepfan Taylor (33) dives over Oregon State...

Image 2 of 20

STANFORD, CA - NOVEMBER 10: Drew Terrell #4 of the Stanford Cardinal is tackled by Sean Martin #6 and Ryan Murphy #25 of the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Drew Terrell #4 of the Stanford...

Image 3 of 20

STANFORD, CA - NOVEMBER 10: Kevin Hogan #8 of the Stanford Cardinal in action against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Kevin Hogan #8 of the Stanford...

Image 4 of 20

STANFORD, CA - NOVEMBER 10: Ryan Hewitt #85 and Zach Ertz #86 of the Stanford Cardinal both land on their backs after Hewitt went in for a touchdown against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Ryan Hewitt #85 and Zach Ertz #86 of...

Image 5 of 20

STANFORD, CA - NOVEMBER 10: Ryan Hewitt #85 of the Stanford Cardinal collides with teammate Zach Ertz #86 on his way to scoring a touchdown against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Ryan Hewitt #85 of the Stanford...

Image 6 of 20

STANFORD, CA - NOVEMBER 10: Kevin Hogan #8 of the Stanford Cardinal in action against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Kevin Hogan #8 of the Stanford...

Image 7 of 20

STANFORD, CA - NOVEMBER 10: Brandin Cooks #7 of the Oregon State Beavers loses his balance after he is hit by a Stanford Cardinal player at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Brandin Cooks #7 of the Oregon State...

Image 8 of 20

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 of the Stanford Cardinal runs with the ball against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 of the Stanford...

Image 9 of 20

STANFORD, CA - NOVEMBER 10: Zach Ertz #86 of the Stanford Cardinal is congratulated by teammates after he scored a touchdown in the fourth quarter of their game against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Zach Ertz #86 of the Stanford Cardinal...

Image 10 of 20

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 is congratulated by Jamal-Rashad Patterson #21 and Drew Terrell #4 of the Stanford Cardinal after he scored a touchdown against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 is congratulated by...

Image 11 of 20

Stanford quarterback Kevin Hogan (8) is hit by Oregon State defensive end Scott Crichton (95) as he throws the ball to running back Stepfan Taylor (33) for a 40-yard touchdown during the third quarter of an NCAA college football game in Stanford, Calif., Saturday, Nov. 10, 2012. (AP Photo/Jeff Chiu)

Photo: Jeff Chiu, Associated Press

Stanford quarterback Kevin Hogan (8) is hit by Oregon State...

Image 12 of 20

Stanford running back Stepfan Taylor (33) runs past Oregon State cornerback Rashaad Reynolds (16) to score on a 40-yard touchdown reception during the third quarter of an NCAA college football game in Stanford, Calif., Saturday, Nov. 10, 2012. (AP Photo/Jeff Chiu)

Kevin Hogan flips the ball to Stepfan Taylor, who would run 40 yards for a score.

Photo: Jeff Chiu, Associated Press

Kevin Hogan flips the ball to Stepfan Taylor, who would run 40...

Image 15 of 20

Stanford tight end Zach Ertz (86) catches a pass in front of Oregon State safety Ryan Murphy (25) during the third quarter of an NCAA college football game in Stanford, Calif., Saturday, Nov. 10, 2012. Stanford won 27-23. (AP Photo/Jeff Chiu)

Photo: Jeff Chiu, Associated Press

Stanford tight end Zach Ertz (86) catches a pass in front of Oregon...

Image 16 of 20

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 of the Stanford Cardinal runs with the ball against the Oregon State Beavers at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 of the Stanford...

Image 17 of 20

STANFORD, CA - NOVEMBER 10: Cody Vaz #14 of the Oregon State Beavers passes the ball during their game against the Stanford Cardinal at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Cody Vaz #14 of the Oregon State...

Image 18 of 20

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 of the Stanford Cardinal gets away from Rashaad Reynolds #16 of the Oregon State Beavers on his way to scoring a touchdown at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Stepfan Taylor #33 of the Stanford...

Image 19 of 20

STANFORD, CA - NOVEMBER 10: Cody Vaz #14 of the Oregon State Beavers leaves the field on a cart after their loss to the Stanford Cardinal at Stanford Stadium on November 10, 2012 in Stanford, California. (Photo by Ezra Shaw/Getty Images)

Photo: Ezra Shaw, Getty Images

STANFORD, CA - NOVEMBER 10: Cody Vaz #14 of the Oregon State...

Image 20 of 20

Oregon State running back Storm Woods (24) runs against Stanford cornerback Alex Carter (25) during the second quarter of an NCAA college football game in Stanford, Calif., Saturday, Nov. 10, 2012. (AP Photo/Jeff Chiu)

On a day when Stanford overcame a season-high four turnovers to beat the No. 13 team in the country, head coach David Shaw admitted he nearly broke down in tears in the locker room afterward.

He was thinking about the seniors who had lost only two home games in four years and especially about Stepfan Taylor, who pulled off what Shaw called "probably the best play of his career."

No. 16 Stanford kept its Rose Bowl hopes alive by rallying from a nine-point deficit to beat Oregon State 27-23 Saturday in the seniors' final regular-season game at Stanford Stadium.

"You want to win your last home game," Taylor said. "You owe it to your teammates, especially the seniors." As he and the other seniors were introduced before the game, he said, "You try not to cry out there."

With 114 yards on 19 carries, Taylor became the first player in Stanford history to rush for 1,000 yards in three straight seasons. He and tight end Zach Ertz both atoned for earlier lost fumbles, Taylor with a magnificent 40-yard run after catching a dump-off pass from Kevin Hogan, the new starting quarterback.

With just over five minutes left, Hogan found Ertz - on Ertz's birthday - for the winning 13-yard touchdown, boosting Stanford (8-2 overall) to sole possession of second place (6-1) in the Pac-12.

"Any time you can get Zach out one-on-one - not many people can cover him, if any," Hogan said. "He ran a great route."

The Beavers (7-2, 5-2) had two more possessions, but cornerback Terrence Brown made a fine play to break up a third-down pass on the first series and force a punt. Finally, Alex Debniak sacked quarterback Cody Vaz and put him out of the game with two minutes left. Sean Mannion's desperate fourth-quarter pass fell incomplete.

Debniak said the sack was the biggest play of his career. "I'm filled with joy for our seniors," he said. "We knew it was going to be a dogfight and might come down to the last play. It's been an emotional day for a lot of us."

Next up for the Cardinal is mighty Oregon, which has shellacked them in each of the past two years and may be better than ever.

"We cannot turn the ball over four times in Eugene," Shaw said. "It can't happen." He said he agreed with "what most people outside the computers say: that this is the best team in the country."

Hogan, of course, will be making only his second career start Saturday. Against the Beavers, he completed 22 of 29 passes for 254 yards and three touchdowns, while throwing two interceptions. He also rushed 11 times for 49 yards and kept many plays alive with his feet.

He called his performance "OK," while offensive coordinator Pep Hamilton was much more laudatory. "Under the circumstances, the way he finished that game was impressive," he said. "A national (TV) audience, a big game. He kept us relevant in the Pac-12 North. He made enough plays for us to win it at the end."

Vaz, in his fourth start of the year, rallied his team after it fell behind 14-0 in the first quarter and completed 23 of 38 passes for 226 yards and a touchdown. However, he dropped the ball on a scramble in the fourth quarter, and Stanford's Josh Mauro recovered at the Beavers' 29.

Six plays later, Hogan and Ertz hit the game-winner.

The play that really broke the Beavers, though, was the final one of the third quarter. Hogan was wrapped up by a defender but, as he was going down, flipped the ball in the left flat to Taylor.

Taylor juked past cornerback Rashaad Reynolds, cut inside strong safety Anthony Watkins, outraced some other defenders and broke two tackles at the 5-yard line on his way to the end zone.

"That's just an amazing play by two playmakers," Hamilton said.

Taylor "beat 75 percent of the guys on the field," Shaw said. "He outran them or broke their tackles. I think it's probably the best play of his career."