Brandon Gibson's 13-yard touchdown catch with 48 seconds remaining lifted the St. Louis Rams over the Buffalo Bills, 15-12.
Gibson ended with six catches for 100 yards for the Rams (6-6-1), who have won three in a row for the first time since 2006 and remain in the wild-card playoff hunt.
Sam Bradford completed 19-of-39 passes for 209 yards, one touchdown and an interception for St. Louis, which scored all 15 of its points in the second half.
Steven Jackson carried the ball 19 times for 64 yards and a score for the victors.
Ryan Fitzpatrick connected on 25-of-32 passes for 247 yards, one touchdown and an interception for the Bills (5-8), who have lost two of three.
"We are not making the plays to win ball games," Bills coach Chan Gailey said. "That is what winninng teams do. Winning teams make plays in the fourth quarter to win ball games. We are not doing that right now. We have to do that or we will not get over the hump. That is what we are supposed to be doing. That is what I am supposed to be getting them to do."
Trailing 12-7, the Rams took over at their own 16 with 4:55 to play. Lance Kendricks caught a 22-yard pass to move the ball into Buffalo territory. On 4th-and-1, Austin Pettis hauled in a pass of nine yards to keep St. Louis alive. Gibson caught an 11-yard pass three plays later to put the ball at the 13. Bradford then hooked up with Gibson in the middle of the end zone. A successful two-point conversion made it 15-12 St. Louis.
Jo-Lonn Dunbar sealed the win for the Rams with a pick of Fitzpatrick.
"The offensive guys came alive on the last drive and made plays," Rams coach Jeff Fisher said.
The Bills started at their own 27 following a pair of punts from each team to start the game. Donald Jones caught a 19-yard pass on the first play to move the ball close to midfield. C.J. Spiller took a screen pass 15 yards on 3rd- and-13, before Scott Chandler hauled in a 15-yard pass. Buffalo had to settle for a 35-yard Rian Lindell field goal with 2:14 left.
Buffalo had a chance to add to its lead at the end of the first quarter. However, Fred Jackson fumbled the ball in the red zone on the final play of the stanza.
The Rams' offense finally started to move the ball late in the second frame. But on 3rd-and-4 from the Buffalo 44, Bradford's pass hit off the back of Bryan Scott. Stephon Gilmore caught the deflected pass for an interception and sprinted 62 yards the other way for a touchdown.
The score was nullified by a holding penalty on the return. Buffalo took over near midfield and eventually settled for a 40-yard Lindell field goal. The Bills took a 6-0 lead into the locker room.
St. Louis opened the second half with an 11-play, 70-yard scoring drive. Gibson caught back-to-back passes of 22 and 16 yards to move the ball to the Buffalo 9-yard line. Steven Jackson capped the march with a 1-yard TD run, giving the Rams a 7-6 edge.
The Bills responded with a touchdown of their own on the ensuing possession. The drive started with three straight plays of at least 11 yards. T.J. Graham added catches of 11 and 16 yards to move the ball to the 11-yard line. On 2nd- and-goal from the two, Fitzpatrick used the play-action pass to find Lee Smith wide open in the end zone. A botched snap on the extra point kept it 12-7 Buffalo with 3:26 left in the third period.
Buffalo had great field position to start the fourth quarter. Rams punter John Hekker managed to get a punt off after dropping the snap. It was a poor punt, though, and the Bills took over near midfield.
The Bills failed to capitalize and were forced to punt.
The Bills lead the all-time series with the Rams by a 6-5 margin ... St. Louis ended the 2006 season with three straight victories ,,, Rams wide receiver Danny Amendola (foot) missed the game .,. The Bills were without cornerback Aaron Williams, defensive end Mark Anderson and center Eric Wood ... Fred Jackson was helped off the field after appearing to hurt his right leg late in the fourth quarter.