The Bulldogs (28-2, 15-0 West Coast Conference) host Portland on Saturday and a win there could mean Gonzaga's first-ever No. 1 ranking.
Gonzaga led by 11 points with 10:51 left but BYU fought back.
Consecutive 3-pointers by Brock Zylstra, another by Craig Cusick and two free throws by Brandon Davies tied it at 60 with 4:18 remaining.
Olynyk hit a key jumper down the stretch and Kevin Pangos made two free throws to help seal it.
BYU had one final chance with 6.6 seconds remaining and down three points but Gonzaga fouled Cusick before he could attempt a 3.
Tyler Haws had 19 points for BYU (20-10, 9-6).
Davies added 12 points and 11 rebounds in his final home game for the Cougars despite being plagued by foul trouble.
The Bulldogs won the first meeting in Spokane, Wash., by 20 points.
Olynyk was nearly perfect in the first game, going 9 of 9 from the field and 8 of 8 from the free throw line for 26 points.
This time, he probably felt as if he were in a football game as it was rough-and-tumble from the start, with a former Cougars football player even called for an intentional foul on Olynyk as he drove the lane.
He finished 7 of 10 from the field.
Bell was the lone Gonzaga player to have any success shooting the 3.
Pangos was 1 of 12 from beyond the arc and the Bulldogs 6 of 30 overall from 3-point range.
But Gonzaga held BYU to 36.5 percent shooting and had a marked advantage at the free throw line. The Bulldogs made 20 of 34 attempts, compared to 13 of 22 for BYU.
BYU's hopes of a seventh straight NCAA appearance may come down to winning the WCC tourney in Las Vegas. The Cougars also could see their streak of six consecutive 25-win seasons end.
At least the Cougars know they pushed Gonzaga to the limit.
After Pangos made two free throws, he fouled Cusick on a 3-point attempt with 7 seconds left.
Cusick made all three, pulling BYU to 67-65. Elias Harris made 3 of 4 free throws down the stretch, while BYU's shooting went cold
Should Gonzaga ascend to the top spot, the question remains whether the Bulldogs would garner a No. 1 seed in the NCAA tournament something they have never achieved.
Their only losses this season were to Butler and Illinois when both were ranked No. 13.
Provided they defeat Portland, they will have won 12 straight heading into the WCC tournament.
On Thursday, they got a test.
The game was physical from the start, with bodies flying, players diving and the pace frenetic.
BYU suffered a blow early when Davies picked up two fouls in 2 1-2 minutes and he was replaced by converted football player 6-foot-7 freshman Bronson Kaufusi.
The Bulldogs went to Olynyk often early. He had seven points in 5 minutes and the Bulldogs bumped their lead to 19-10 thanks to two 3-pointers by Bell.
The Cougars pulled to 23-18 on Davies' reverse dunk with 8:08 left in the half and were within 25-23 on a long jumper by Haws with 6:30 left.
Gonzaga led 35-31 at halftime but opened the second half with another 3-pointer by Bell and dunk by Olynyk, who forced Davies into his third foul less than 4 minutes in.
Davies picked up foul No. 4 with 13:33 left.
The game only got rougher, with Kaufusi called for an intentional foul as Olynyk drove to the basket with 11 minutes left.