SAN FRANCISCO (AP) -- From the third-string quarterback to the $80 million cornerback, the San Francisco 49ers finally came together as the team they imagined three months ago.
And from Cincinnati's awful opening drives to Chad Johnson's final drop, the Bengals' season fell apart in ways they couldn't believe.
Shaun Hill passed for 197 yards and a touchdown and ran for another score in his first NFL start, and the 49ers beat the Bengals 20-13 on Saturday night for just their second victory in 12 games.
Frank Gore rushed for a season-high 138 yards, and Darrell Jackson had a season-high eight catches for 86 yards in a surprisingly effective San Francisco (4-10) attack led by Hill, a six-year veteran backup who only threw his first NFL passes last week after Trent Dilfer got a concussion.
With Alex Smith also sidelined, Hill was the only quarterback left in San Francisco -- and he improbably sparked the 49ers' league-worst offense to the club's first home victory since opening week. Hill went 21-of-28, hitting Vernon Davis with a precise TD pass 9 seconds before halftime and generally running the show with confidence.
"I had confidence in myself, but obviously it's nice to go out and actually do it," said Hill, whose last start was for NFL Europe's Amsterdam Admirals in 2003. "It's one thing to sit there and visualize everything and feel like you can make all the plays. It's another to go out and do it."
The third quarterback was the charm for the 49ers, but the defense also deserved some credit. Cornerback Nate Clements led a solid effort against Carson Palmer's receivers through several tough situations, including the Bengals' last drive.
"We just wanted to show we can do what we've been capable of doing all season," said Clements, who became the NFL's highest-paid defensive player when he joined San Francisco as a free agent. "Shaun did a nice job, but it was good to have a chance to win a game as a defense. They're high-powered, but we mostly kept them in check."
Palmer threw his 100th touchdown pass, a 52-yard strike to Chris Henry in the first half, to become the fifth-fastest passer in NFL history to reach the mark. Palmer passed for 252 yards, but last season's Pro Bowl MVP couldn't rally the Bengals (5-9) to a tying score -- not after Johnson dropped a difficult fourth-down catch in the end zone with 2:14 left.
"It's the same thing that's been killing us all year -- execution," Palmer said. "If you don't have 11 guys doing each of their own jobs right on every single play, you're going to have bad plays and miscues and negative plays."
Losing to the NFL's worst offense had to be one of the Bengals' most embarrassing defeats in coach Marvin Lewis' five seasons. Cincinnati, which hasn't won consecutive games all season, is assured of its first losing record since 2002.
"Frustrating, just a little, but it's a lot more disappointing because we've underachieved so much," Cincinnati guard Bobbie Williams said. "It's not like us, but that's what we keep putting on film."
After spending most of the season dead last in many offensive statistical categories, the 49ers looked downright competent from their opening 76-yard drive. Hill finished it with a 3-yard bootleg for a touchdown that gave San Francisco its first lead at home since its season-opening victory over Arizona.
Hill rallied the 49ers again on another long drive capped by an impressive 17-yard throw to Davis in coverage. Davis, the athletic tight end often underutilized by Smith and Dilfer, celebrated by jumping into the crowd as the 49ers earned their first halftime lead of the season.
"Shaun did a great job," said Davis, who had five catches for 46 yards. "He came out and took charge. He showed everybody that he can play. He stepped it up a notch."
Joe Nedney hit two field goals in the third quarter, but 49ers coach Mike Nolan passed up the chance to kick a 42-yarder with 6:15 to play at his players' insistence, instead failing on a fourth-down conversion attempt.
The Bengals' T.J. Houshmandzadeh set the franchise record with his 101st reception on a fourth-down conversion as Cincinnati moved to the 49ers 24. But Johnson couldn't hold on to a fourth-down throw in the end zone with 2:14 to play, failing to gather the precise pass to his body as he fell out of bounds.
"I just hit the ground really hard," Johnson said. "I tried to squeeze it. I had possession, I had my feet in, and I tried to hold onto the ball the best I could. I had control until I hit the ground."
The call was upheld on video review, and Gore sealed it with a gutsy 10-yard run on third-and-9 for the 49ers' final first down.
San Francisco DT Bryant Young again hinted at retirement, saying he'll announce his decision in the days before next Sunday's home finale against Tampa Bay. "It's near the end, like I said before," said Young, a 14-year veteran. "My days are numbered, so it's time for me to enjoy it." ... Cincinnati LB Rashad Jeanty was deactivated despite being listed as probable. Corey Mays replaced him. ... Only Dan Marino (44 games), Kurt Warner (50), Johnny Unitas (53) and Peyton Manning (56) reached 100 TD passes faster than Palmer.