SALT LAKE CITY (AP) -- Just beating Utah for the first time in five years would have been gratifying for No. 21 Brigham Young.
Winning the way the Cougars did made it a classic.
"It was great to be able to be a part of that BYU magic," said Beck, who passed for four touchdowns in his first win over the rival Utes.
But that was still plenty of time for Beck, who used every second on the clock and a few more. With 3.2 seconds left, Beck rolled to his left and was still scrambling to find an open receiver well after time expired.
Beck reversed to his right, then threw a pass across his body to Harline, who cradled the ball in while on his knees.
"It felt like that last play took forever," said Harline, who caught three of Beck's touchdown passes.
The victory was vindicating for Beck, a senior who threw an incompletion on fourth down to end an overtime loss to the Utes in Provo last year.
"He's a great quarterback and will be measured with the greats here," BYU coach Bronco Mendenhall said. "The longer he held it, the better I felt because I know how difficult it is to cover for that long."
The Cougars erupted in celebration and fans rushed the field after Harline's catch, but BYU still needed to take a knee on the point-after attempt to officially end the game. After four years of frustration, the party could wait just a few more moments.
"The feeling was just complete gratification for our captains, for our seniors and for this program that in two short years have answered a lot of critics," Mendenhall said.
The Cougars (10-2, 8-0) will close the season in the Las Vegas Bowl on Dec. 21. Utah (7-5, 5-3) was still waiting for its bowl invitation.
Ratliff was 24-for-39 for 358 yards and three touchdowns for Utah (7-5, 5-3) and led the Utes to 24 straight points after they fell behind 14-0 in the first quarter. But Beck was slightly better, going 28-for-43 for 375 yards and four touchdowns.
"It's hard to play so well and come up short," Ratliff said. "This is a tough loss for the whole team, but we have another game to play."
After BYU dominated the first quarter, the Utes held the Cougars to minus-12 yards in the second and scored the next 24 points. The Cougars rallied from a 24-14 deficit and took advantage of two pass interference calls to retake the lead.
One of the penalties gave BYU a first down after a third-and-24 and the Cougars scored on a 5-yard pass to Harline with 13:15 left in the game. The Utes blocked the extra point and led 24-20.
Another interference call on third-and-goal from the 10 led to Beck's 2-yard touchdown pass to Daniel Coats, putting BYU up 27-24 with 3:23 left.
Utah still had plenty of time and Ratliff led the Utes 83 yards for what looked like it would be the winning touchdown. Ratliff ran for six yards on fourth-and-2 from the Utah 25 with 2:20 left, then on first down found Casteel over the middle for a 37-yard gain.
From the BYU 19, Casteel caught a slant pass over the middle and had blockers lined up all the way to the end zone.
But the Cougars still had time and Beck went 6-for-9 on the final drive, not counting one play when he spiked the ball to stop the clock. Then Beck, who missed one game this season with injuries to both his ankles, was quick enough on his feet for the final score.
"The last play was just a long play," Utah coach Kyle Whittingham said. "Their quarterback did a great job of staying alive until somebody was open."
Utah outgained BYU 474 yards to 429 despite gaining just 30 yards in the opening quarter.
Louie Sakoda had a 24-yard field goal and ran a fake punt 18 yards to set up Utah's first touchdown, an 18-yard pass from defensive back Eric Weddle to Casteel that cut the lead to 14-7 in the second quarter. Ratliff added a 57-yard touchdown pass to Marquis Wilson and a 4-yard scoring pass to Colt Sampson in the third, giving Utah the 24-14 lead.