The San Francisco 49ers managed to pull off a thrilling 23-17 victory over the Dallas Cowboys on Sunday at AT&T Stadium, but a crucial mistake late in the game almost came back to haunt them.

On fourth-and-1 late in the fourth quarter, tackle Trent Williams was penalized for a false start on a QB sneak that would've sealed the deal right then and there for the 49ers. But, as Kyle Shanahan explained post-game Jimmy Garoppolo was actually to blame for the penalty.

Via Pro Football Talk:

“We just shifted to an unbalanced,” Shanahan said, via NBCSportsBayArea.com. “It was on the silent count and it was quarterback sneak all the way, but Jimmy got really excited because of the look. Didn’t let Trent get set. He’s got to let him get set. It ended up not being a problem though, would have been a struggle to answer that one if it was.”

The 49ers ended up having to punt and the Cowboys put together a pretty impressive drive. But, Dak Prescott decided to run the ball himself with only about 10 seconds left, and then the referee appeared to be out of position before Dallas could get off another snap. Talk about the weirdest ending to a game ever.

Jimmy G and Shanahan breathed a sigh of relief as the 49ers now move on to face the Green Bay Packers at Lambeau Field. Garoppolo surely wouldn't have lived that one down too quickly if Dallas scored a game-winning touchdown.