When BYU ran the third down play, BSU had 1 timeout left. When they saw it was 4th down, they used that timeout. No timeouts left.
Subsequent to that, the refs instead decided to measure to make sure. I still don't know exactly what was going on with that. The ball wasn't touching the 35 yard line, so I have no idea how they could measure that as a first down when the original line of scrimmage was the 25 yard line. Anyway, they gave BYU a first down. At that point, I think BSU was able to argue with the refs that the new ruling affected how they wanted to use their final timeout. The refs allowed them to challenge, they won the challenge, and then immediately used their final timeout anyway.
So, it may seem kind of weird that they got to challenge after using their final timeout, but I think it makes sense.