San Francisco's stingy defense denied Matthew Stafford another milestone, Vernon Davis caught touchdown passes of 21 and 23 yards from Alex Smith, and the 49ers beat the Detroit Lions 27-19 on Sunday night in a September showdown of NFC powers.