Terrell Newby rushed for a one-yard touchdown as time expired while third-string quarterback Taylor Heinicke ran for a two-point conversion to carry the Minnesota Vikings to a 32-31 win over the San Francisco 49ers in Sunday’s preseason game at U.S. Bank Stadium. Replacing Case Keenum with 2:44 remaining in the game and with the 49ers up, 31-24, Heinicke engineered a 14-play, 63-yard drive scoring drive that Newby ended with a one-yard scoring burst. Instead of trying to send the game into overtime, the Vikings went for a two-point attempt, which Heinicke completed with a run to the right side.

With the win, the Vikings improved to 2-1 in the preseason.

Starter Sam Bradford played the entire first half, completing 17 of 21 passes for 134 yards. Keenum, the presumed backup, started the second half, going 10-for-14 for 139 yards and touchdown passes to Rodney Adams and Kyle Carter. Heinicke went 8-for-12 for 73 yards for the Vikings, who trailed by as many as 14 points. Stacy Coley caught four passes for 76 yards while Adam Thielen caught five passes for 50 yards. Jerick McKinnon led the Vikings’ ground attack, rushing for 27 yards on seven carries while Dalvin Cook carried the ball five times for 17 yards.

Brian Hoyer had another solid performance

Presumed starter Brian Hoyer completed 12 of 17 passes for 176 yards and two touchdowns without an interception for a rating of 143.3 as the 49ers dropped to 1-2.

C.J. Beathard went 7-for-13 for 159 yards with a touchdown and an interception while Matt Barkley completed both of his passes for 19 yards. Raheem Mostert caught two passes for 104 yards and a score, Pierre Garcon received six passes for 64 yards while Marquise Goodwin and Carlos Hyde each caught a touchdown pass. Matt Breida ran the ball seven times for 29 yards for the 49ers.

Rookie Reuben Foster, taken 31st overall in the 2017 NFL Draft, anchored the 49ers defense with eight total tackles.

49ers waxed hot in first half

Hoyer completed his first nine passes of the game to give the 49ers a 14-0 lead at the break. The Vikings inched closer with a 58-yard field goal by Marshall Koehn but Nick Rose answered with a 55-yard boot for a 17-3 advantage.

Keenum connected with Adams for a nine-yard touchdown pass after a 7-play, 75-yard drive but Beathard countered with an 87-yard scoring strike for a 24-10 advantage. McKinnon ended the third by returning a kickoff for a 108-yard touchdown that put the Vikings within striking distance. Mostert opened the fourth with a four-yard touchdown run but it was all Vikings from there as Keenum found Carter for a 16-yard touchdown pass to cut the deficit to 31-24.