The score came with 2:16 left and capped a 14-play, 68-yard drive in which Smith was a non-factor. Smith, the NFL's leading receiver this season, finished with three catches for 55 yards.
"They rolled to Smitty a good bit and we had to be patient," Delhomme said. "Just take what they give you. It was going to be one of those games where you were going to have to be smart."
Delhomme was both patient and smart. He finished 20-of-27 for 191 yards passing, erasing the dreadful memories of his performance last weekend, when he threw two interceptions and was sacked a career-worst eight times in a 13-3 loss at Chicago.
"We came straight at them like we always do," safety Mike Minter said. "We stopped them with seven guys in the box. When you can do that as a defense, you're playing well."
The Panthers limited Buffalo to 216 yards offense, the sixth straight opponent they have held under 300 yards. They also have 23 sacks in their past six games.
Carolina (8-3) took over sole possession of the NFC South lead, a game ahead of Tampa Bay, which lost to Chicago.
"Everybody had us as the worst team on the planet after that last game," Panthers coach John Fox said. "This has been a resilient bunch."
The Bills (4-7) squandered two three-point leads and settled for Rian Lindell's three fields goals despite three trips inside the Panthers 20.
"When it counted the most, we stalled," Losman said. "We as a team and as players have to figure out how to win these types of game, these close games."
Making his second straight start, Losman finished 16-of-29 for a career-high 197 yards passing and an interception.
Buffalo has lost four of its past five.
Trailing 9-6 after Lindell hit a 33-yarder, Delhomme started on his 32, heading for the ninth fourth-quarter comeback of his career.
Facing third-and-goal, Delhomme twice faked a handoff, set up in the pocket and threw over the middle to Gaines, who had a step on backup safety Coy Wire. Wire was in the game after starter Lawyer Milloy limped off and didn't return after hurting his right foot earlier in the drive.
The touchdown was the Panthers' first offensive score in more than 131 minutes of game time since Stephen Davis scored on a 1-yard plunge with 13:25 left in the fourth quarter of Carolina's 30-3 win against the New York Jets two weeks ago.
"You can't get frustrated," Gaines said. "You get frustrated, it's like quicksand, you're going to keep sinking and sinking and sinking. We just kept encouraging each other."
DeShaun Foster finished with 23 carries for 77 yards.
John Kasay rounded out Carolina's scoring, hitting two of three field goal attempts. He missed a 45-yarder wide right in the third quarter in relatively calm conditions.
The Bills red zone troubles continued to plague them. They have now scored 11 touchdowns in 32 trips inside an opponent's 20 this season.
In their three red zone drives Sunday, Losman went 0-for-3, while Willis McGahee managed only 7 yards on six rushes -- and the running back was also penalized 15 yards for a chop block.
"We just have not capitalized," Bills coach Mike Mularkey said. "I wish I could explain. It's not that we don't have guys open or don't have the ability to run down there."
- Former Bills quarterback Frank Reich was honored at halftime, receiving the Ralph C. Wilson distinguished service award, named after the team's owner. Reich, who also played for Carolina and now lives in Charlotte, N.C., is best known for rallying Buffalo from a 35-3 deficit to a 41-38 win over Houston in the 1993 AFC wild-card playoff game -- the greatest comeback in NFL history.
- Smith now has 1,161 yards receiving, setting a single-season career high.
- The Bills were without three starters: cornerback Terrence McGee (hamstring), defensive tackle Sam Adams (ankle) and tight end Mark Campbell (hamstring). Buffalo then lost starting left guard Mike Williams, who hurt his back in the second quarter.