Former Bears kicker Robbie Gould came back to haunt his old team Sunday at Soldier Field, booting five field goals without a miss to lead the San Francisco 49ers to a 15-14 victory.

Gould’s final kick, a 24-yard chip shot with :04 remaining in the game, capped a 14-play, 86-yard drive that burned 5:23 off the clock. The 49ers picked up four first downs on the possession—which began at their own 8—preventing the Bears offense from touching the ball again.

“Obviously, this was a very disappointing loss,” said coach John Fox. “In a nutshell, if you don’t give up an offensive touchdown, you’re going to win your share of games in this league. But that wasn’t the case today.”

The Bears (3-9) have now dropped five straight games for the first time since they lost their last five contests in Marc Trestman’s final year as coach in 2014. They’re also assured of having four consecutive losing seasons for the first time since they endured five straight from 1996-2000.

The 49ers (2-10) won for the second time in three games following an 0-9 start.

The Bears offense continued to struggle, mustering only 147 total yards against a 49ers defense that entered Week 13 ranked 28th in the NFL, allowing an average of 374.2 yards per game. The unit has now produced just six touchdowns in its last six contests.

The Bears defense forced the 49ers to settle for field goals on all five of their red-zone possessions. But the unit permitted San Francisco to march 60, 66, 58, 70 and 86 yards to set up Gould’s five field goals of 33, 28, 35, 34 and 24 yards. The 49ers sustained drives throughout the game by converting 56 percent of their third-down opportunities (10 of 18).

“I don’t think we played well enough on third down,” Fox said. “The third-down defense was problematic. I will say, though, that the red-zone area defense was pretty good, those opportunities of not allowing a touchdown.”

Despite needing a last-second field goal to win, San Francisco held decisive advantages in total yards (388-147), first downs (23-8) and time of possession (38:47-21:13).

Tarik Cohen produced the play of the day with a spectacular 61-yard punt return touchdown that gave the Bears a 14-6 lead midway through the second quarter. The dynamic rookie caught the punt at his own 39, retreated to his own 24 while racing to his right and then reversed field, following a wall of blockers to the end zone for a highlight-reel TD.

Cohen struck again early in the fourth quarter. With the Bears protecting a 14-12 lead, he returned a punt 67 yards to the 49ers’ 16. But a penalty on Ben Braunecker for an illegal block in the back nullified the return and pushed the Bears back to their own 14, a difference of 60 yards.

The only touchdown the offense scored came on Mitchell Trubisky‘s 8-yard strike to Dontrelle Inman across the back of the end zone, giving the Bears a 7-3 lead late in the first quarter.

The TD was set up by Kyle Fuller‘s first interception since Dec. 13, 2015. The 2014 first-round pick ripped a Jimmy Garoppolo pass away from receiver Louis Murphy at the Bears’ 41. Fuller also had six tackles, one tackle-for-loss and two pass breakups in the game.

Making his first start as 49ers quarterback since being acquired in a trade with the Patriots Oct. 31, Garoppolo completed 26 of 37 passes for 293 yards with one interception and an 82.4 passer rating. He set up Gould’s winning field goal with a 33-yard completion to receiver Trent Taylor to the Bears’ 18 on third-and-nine with just under two minutes remaining.

Trubisky was efficient, completing 12 of 15 passes for 102 yards with one TD and a 117.2 rating. But the Bears rushing attack was limited to 62 yards on 19 carries by a 49ers run defense that entered Week 13 ranked 30th in the NFL, allowing an average of 129.5 yards per game.

“I don’t think we really established the run game,” Fox said. “I think Mitch was improved. We were 5-for-10 on third downs. But all-in-all it was a low scoring game and we came up on the short end.”