The New York Jets were on the verge of the greatest comeback in NFL playoff history today before Bill Simpson's interception near the goal line in the final seconds preserved the Buffalo Bills' 31-27 victory at half-empty Shea Stadium.

For the Bills, the third-place team in the AFC East, the wild-card game victory was their first in the playoffs since 1965. They once enjoyed a 24-0 lead today. No team has ever recovered from that big a deficit.

Simpson's interception was his second of the game and the fourth thrown by Jet quarterback Richard Todd, who completed 28 of 51 attempts for 377 yards. Another interception was nullified by a penalty in the final Jet drive that ended with Simpson's big play.

"When the play started, I looked into the backfield and just read Todd's eyes. He was following the receiver all the way. I just stepped up and it was in my hands," Simpson said. "I felt great! To tell you the truth, I was glad to get off the field. I was so tired I had trouble standing up."

Todd accepted blame for the final interception: "It was a bad read by me. I never saw Simpson until he caught the ball. I was looking for (Derrick) Gaffney and I thought he was open."

It wasn't the rain or chilling wind that drove many of the 57,050 fans home early. The exodus started in earnest after Joe Cribbs took a pitchout, circled his right end and ran 45 yards for the touchdown that gave Buffalo a 31-13 lead with 10:16 to play.

"When Joe broke away, I thought we had the game," said quarterback Joe Ferguson, who helped build the Bills' advantage with two touchdown passes to Frank Lewis in the first half. "The Jets showed a lot of class and a lot of guts coming back the way they did."

When Todd's 51st pass, intended for wide receiver Derrick Gaffney in the end zone, wound up in Simpson's grasp, it gave the Bills a berth in the AFC semifinals against the Central Division champion Bengals (12-4) at 1 p.m. Sunday in Cincinnati.

Since winning back-to-back American Football League titles in '64 and '65, the Bills have participated in only four playoff games, losing in '66, '74 and last year, 20-14, to San Diego. Simpson was the defender beaten on the touchdown pass that ousted the Bills last season.

"After all these years, it would be the greatest thrill of my life to go to Detroit for the Super Bowl," said a beaming Ralph Wilson, the Bills' owner, in the cramped dressing quarters.

The first thing the Bills are going to have to do in order to upset Cincinnati is plug a leaky secondary that allowed Todd to complete 28 passes for 377 yards and two touchdowns.

"We were playing well, when all of a sudden they got hot," said Simpson, a seven-year veteran who was brought out of retirement by Coach Chuck Knox early last season when the Bills' first two safetymen were injured.

"They were presented with an opportunity to get back into it and they took advantage. Once they started driving, things sort of snowballed."

Todd had directed scoring drives of 80 and 58 yards on the Jets' two previous possessions and was threatening to put them ahead after a seven-yarder to Scott Dierking gave his team a first down on the 10 with 14 seconds remaining.

After bouncing a first down attempt at tight end Mickey Shuler's feet, Todd was looking for four-year veteran Gaffney when Simpson stepped in and spoiled the fun.

"I had coverage on Dierking," Simpson explained. "It was a waggle pass and I had him checked. Then I saw the ball and just stepped in front of the wide receiver."

The Jets' passing game was ripe for picking after Buffalo's 17 points in the first quarter forced New York to almost abandon the running game. The Jets finished with only 71 yards in 22 carries.

The game started on a shocking note for the home team. The Jets' Bruce Harper fumbled returning the opening kickoff and Charles Romes took the ball 26 yards for a Buffalo touchdown.

"He just stripped the ball from me," Harper said of the hit by Ervin Parker at the 25. "It's one of those things that happen. This was just a hell of a time for it to happen."

The Bills scored twice more in the first quarter. After Pat Leahy's 52-yard field goal attempt fell short for New York, Buffalo took three plays to get its second touchdown. Ferguson threw to Lewis on a simple turn-in pattern. Lewis outmaneuvered cornerback Donald Dykes and sprinted to the corner to complete a 50-yard play.

An interception and 49-yard return by cornerback Rufus Bess gave the Bills a chance for a third touchdown. The Jet defense tightened, however, holding Buffalo to one yard on three downs, and the Bills settled for a 29-yard field goal by Nick Mike-Mayer.

Midway through the second quarter, Buffalo scored on another Ferguson-to-Lewis play, this one covering 26 yards.

"They blitzed and that left the middle open," said Lewis. "I ran a post pattern and it was just a matter of if Joe recognized it in time. He did."

After early trading, the New York Sack Exchange was down 24 points.

"The only thing I can say about us being down, 24-0, and coming back was that it was like being down 0-3 at the beginning of the season," said New York Coach Walt Michaels. "It's just sign of character that we never give up."