Baltimore Ravens wide receiver Steve Smith (89) catches a 34-yard touchdown pass in front of San Francisco 49ers strong safety Antoine Bethea (41) and cornerback Kenneth Acker during the second half of an NFL football game in Santa Clara, Calif., Sunday, Oct. 18, 2015. (AP Photo/Ben Margot)

Baltimore Ravens wide receiver Steve Smith (89) catches a 34-yard touchdown pass in front of San Francisco 49ers strong safety Antoine Bethea (41) and cornerback Kenneth Acker during the second half of an NFL football game in Santa Clara, Calif., Sunday, Oct. 18, 2015. (AP Photo/Ben Margot)

The Baltimore Ravens marked their worst start to a season in franchise history, falling 25-20 to the San Francisco 49ers and sliding to a 1-5 record on Oct. 18 in San Francisco. 

The 49ers win snapped a four-game losing slump, having entered the game with the same 1-4 record as the Ravens. Meanwhile, Baltimore lost yet another close game in the fourth quarter; all five of the Ravens’ losses this season were decided by six points or less. 

Baltimore had chances for big plays that would have altered the outcome of the game. Ravens quarterback Joe Flacco found veteran receiver Steve Smith Sr. open in the end zone twice in the first half, but both times Smith dropped the passes. With Smith’s drops, the Ravens had to settle for short field goals instead, turning what should have been 14 points into just six points. San Francisco went on to take a 16-6 lead into halftime. 

Smith finally caught a touchdown pass from Flacco in the third quarter, cutting the 49ers’ lead to 19-13. He finished with a game-high seven catches for 137 yards. 

Baltimore appeared to have shifted the momentum in its favor for a possible comeback, but a missed 45-yard field goal by the usually reliable Justin Tucker in the fourth quarter ended up haunting the Ravens down the stretch. Baltimore had one last chance to win the game after receiving the ball at their own 20-yard line with 1:06 left. But down 25-20 with no timeouts, the Ravens were only able to make it to the 49ers’ 35-yard line before time expired. Had Tucker made the 45-yard field goal earlier in the fourth quarter, Baltimore would have been in position for a game-winning field goal. 

Flacco tossed a game-high 343 passing yards with two touchdowns on 33 of 53 pass attempts, but also tossed two bad interceptions. Running back Justin Forsett ran for 62 yards on 17 carries for the Ravens. 

49ers quarterback Colin Kaepernick had his best game of the season, completing 16 of 27 pass attempts for 340 yards and two touchdowns. Former Ravens receivers Anquan Boldin and Torrey Smith were Kaepernick’s favorite targets; Boldin caught a team-high five catches for 102 yards and Smith caught three passes for 96 yards, including a 76-yard touchdown bomb. 

Next: Baltimore will travel to Arizona to face the Cardinals (4-2) on Monday Night Football on Oct. 26. Kickoff set for 8:20 p.m.