Seattle scored the game's first 17 points but fell behind, 19-17, after a 33-yard field goal by Owen Pochman with 8:09 remaining.
Hasselbeck ran for 17 yards on third down from the Seattle 41 before Josh Brown kicked a 37-yard field goal with 3:09 left.
The 49ers drove to their 43 by the two-minute warning, but Seattle's Chad Brown poked the ball from Garrison Hearst, and Hamlin pounced on it.
Hasselbeck completed 17 of 27 passes for 207 yards, one touchdown and one interception for Seattle (4-1), which is off to its best start since 1986.
Garcia went 16 of 27 for 168 yards and ran for a score for the Niners (2-4).
Celebrity Couples of 2014 [PHOTOS]