SAN FRANCISCO — Seattle’s defense has been stingy late in games all year, but on Sunday against the 49ers, they let a moment get away from them.

Seattle blew fourth-quarter leads seven times last season, including the crushing loss in the playoffs at Atlanta. This season, with a more experienced group, the Seahawks had surrendered only one lead — in a loss at Indianapolis.

The 49ers became the second team to pull that off, eating up nearly six minutes on their key drive in the fourth quarter before kicking a 22-yard field goal for a 19-17 win.

“It’s just a learning experience,” safety Earl Thomas said. “You learn from it and you grow. … This is a good experience for us.”

The defense held San Francisco to just one touchdown and four field goals, despite dealing with short fields much of the day. But on the biggest drive of the game, in need of a stop, the Seahawks couldn’t hold.

The 49ers’ final drive started at their own 20 with 6:20 left. There were two decisive blows.

First, running back Frank Gore gashed Seattle for 51 yards up the gut on a play San Francisco’s coaches had kept in their back pocket all game. The Seahawks had a bust, meaning someone wasn’t where they were supposed to be. Gore then juked Thomas, who was in position to stop the play but overran it.

“It was my fault right there,” Thomas said. “If something breaks, I’ve got to make that tackle, and it didn’t happen.”

Second, with San Francisco facing third-and-seven from the Seattle 15, quarterback Colin Kaepernick took a shotgun snap and bolted for eight yards and a first down. The Seahawks had taken their final two timeouts before that play in hopes of giving their offense more time.

Instead, San Francisco ran the clock down and kicked the go-ahead field goal with 26 seconds left.

And Seattle’s defense, for one of the rare times this season, didn’t hold.

Jayson Jenks: 206-464-8277 or jjenks@seattletimes.com; on Twitter: @jaysonjenks. Jayson Jenks covers the Seahawks for the Seattle Times. He also provides coverage of other Seattle-area teams throughout the year.