BALTIMORE -- Both of the 49ers' losses happened in the same fashion: A hard fought battle ended by a quarterback scramble to set up a game-winning field goal.

Ravens quarterback Lamar Jackson scrambled for 2 yards on third down after the two-minute warning to set up Justin Tucker’s 49-yard game-winner on Sunday to beat the 49ers, 20-17. Seahawks QB Russell Wilson scrambled for 18 yards on a third down in overtime to keep the drive alive, setting up Jason Myers for walk-off field goal in Week 10, handing San Francisco its first loss.

The 49ers will get a chance to avenge their loss to the Seahawks when they travel to Seattle in Week 17. The only possible chance they have to get a rematch with the Ravens is in Miami at the Super Bowl.

The 49ers' offense matched or edged out the Ravens in several categories, but couldn’t get it done on the scoreboard. The 49ers outgained the Ravens by 48 yards and averaged six yards per play while the defense held the Ravens to 4.7 yards per play.

Quarterback Jimmy Garoppolo completed 15 of his 25 passes for 165 yards, one touchdown and a 110.2 passer rating while Jackson connected on 14 of his 23 attempts for 105 yards, one touchdown and a 86.3 rating.

Though they are still taking the season one game at a time, the 49ers would love nothing more than to get another chance to play the Ravens. After coming up just a few plays shy of pulling out a win in the pouring Baltimore rain, coach Kyle Shanahan wants another shot.

“I was real proud of the team,” Shanahan said after loss. “They played extremely hard in all three phases. We definitely played against a real good team, but I was real happy with how the guys played. We had every chance to win the game, and we came up a little bit short at the end. Credit to them.

"Hopefully, we’ll earn an opportunity to get a chance to play them some other time.”

Tight end George Kittle’s love for the game already has him pumped to play the Saints on Sunday but he too would love revenge on the Ravens.

“Definitely, that would be a good opportunity,” Kittle said. “Hopefully we can get that done. That was really fun. I’m just looking forward to hopefully getting another opportunity again. It was great game. I think two of the best teams in the NFL went at it, and they made a couple more plays than we did.

"It’s tough.”

[RELATED: Why 49ers tight end Kittle credits father for his toughness]

Outside of a few veterans, the majority of the 49ers roster never has been to the playoffs. Their matchup in Baltimore, however, might have given them a little taste of what the atmosphere would be like.

“Definitely, every week is big, but being out on the field, it was a dog fight,” defensive lineman DeForest Buckner said. “It definitely felt like a playoff game. God willing, we make it to the end, and hopefully we go against them again.”