EAST RUTHERFORD, N.J. - The New York Jets were facing a stinging loss that would have knocked them out of first place in the AFC East and severely damaged their playoff hopes.

A bad play selection, a big hit and a lucky bounce changed all that in an instant.

Abram Elam sacked J.P. Losman from behind and caused a fumble, and Shaun Ellis picked up the ball and rumbled 11 yards into the end zone with 1 minute, 54 seconds left to give the Jets the go-ahead score in a 31-27 win yesterday.

"That play that Shaun makes and Abe makes, who knows?" quarterback Brett Favre said. "At the end, we may look back and say that could be one of those plays that catapulted us into something great."

Maybe, but the Jets (9-5) looked nothing like a playoff team for most of this one as the Bills' once-dormant offense prospered against New York's struggling defense.

Buffalo (6-8) was nursing a 27-24 lead and close to wrapping up its first win against an AFC East opponent when Losman dropped back to throw and was hit from behind by a blitzing Elam. The ball squirted out and bounced before Ellis grabbed it, tiptoed down the sideline and splashed into the end zone.

"I just kept running, got some good blocking and was able to get into the end zone," Ellis said.

The big play came as Ellis is dealing with legal troubles. He was arrested Nov. 29 and charged with possession of marijuana, speeding and driving without insurance after being pulled over by police in Hanover, N.J.

The Jets were surprised the Bills were passing in that situation, expecting Buffalo to try to run out the clock. Marshawn Lynch had gained 127 yards on 21 carries, and New York was struggling to stop him. Instead, coach Dick Jauron overruled offensive coordinator Turk Schonert.

"Clearly the responsibility for the last call, the play-action pass, that was mine," Jauron said. "That goes right on me. It backfired and caused us to lose the game. . . . It's one of those times in a game that's pretty good for a pass, right before the two-minute [warning]."

Jauron refused to blame Losman, making his second straight start for the injured Trent Edwards.

"It's on my shoulders to protect him, to keep him from that situation," Jauron said, "and I didn't do it."

It was a hectic scene as bodies flew everywhere near the end zone, with even referee Jeff Triplette getting knocked to the turf face-first by Bills center Duke Preston and suffering a bloody nose. He worked the rest of the game wiping his face with a towel.

Buffalo got the ball back twice, with both drives ending on interceptions, including Losman's desperation heave as time expired that was picked off in the end zone by Kerry Rhodes.