DETROIT (AP) -- Matthew Stafford threw a go-ahead touchdown in his first preseason game of the year and the Buffalo Bills came back to beat the Detroit Lions 24-20 Friday night in a preseason game that became significant because key players on both teams were hurt.
Detroit linebacker Jarrad Davis was carted off the field early in the first quarter with an injured right leg and center Frank Ragnow had to be helped off the field after appearing to hurt his right knee.
Bills guard Quinton Spain limped off the field with an ankle injury in the first quarter and cornerback Tre'Davious White left the game with a bruised quadriceps in the second quarter.
Stafford, meanwhile, got on and off the field unscathed.
He was 12 of 19 for 137 yards with an 11-yard touchdown pass to Ty Johnson, perfectly connecting with the rookie running back in the flat while linebacker Matt Milano was covering him closely, to give Detroit a 14-10 lead early in the second quarter.
Lions kicker Matt Prater made a 61-yard field goal as the second quarter ended to narrow the Bills' lead to 14-13 at the half.
Buffalo's Josh Allen was 3 of 6 for 49 yards in the first half, playing against starters. Against reserves, Matt Barkley completed 12 of 14 passes for 142 yards and a 16-yard touchdown pass to Duke Williams late in the third quarter to give Buffalo an 11-point lead.
The Bills (3-0) were able to run out the clock on the final possession to stay undefeated, leaving the Lions (0-3) winless in the preseason.
Bills: Spain going to the sideline may add to the team's woes on the offensive line. Center Mitch Morse missed the game because he has been in concussion protocol. Ike Boettger replaced Spain in the lineup against the Lions. Levi Wallace left the game briefly in the second quarter after appearing to be injured, but the starting cornerback was able to return.
Lions: Davis' and Ragnow's potentially serious injuries put rookie linebacker Jahlani Tavai, a second-round pick from Hawaii, on the field with starters on defense and guard Graham Glasgow was moved to center.
Bills: Host Minnesota on Thursday night.
Lions: Play at Cleveland on Thursday night.