SANTA CLARA, Calif. -

Jim Harbaugh got doused with a celebratory shower after his final game coaching the San Francisco 49ers, then said his goodbyes with handshakes and hugs all around.

Colin Kaepernick confidently declared he's still the quarterback capable of leading this team back to the Super Bowl. Frank Gore cried, contemplating what might have been his last game in a Niners uniform.

In a bizarre finish to a most bizarre season, San Francisco beat the Arizona Cardinals, 20-17, yesterday and avoided ending on a losing note and with a losing record in a year that began with Super Bowl aspirations.

"I'm forever proud to have been a part of this," Harbaugh said. "It's been a tremendous 4 years, it's been a pleasure to work and serve for this organization."

Kaepernick threw a go-ahead, 3-yard touchdown pass to Bruce Miller late in the third quarter and Gore capped another 1,000-yard season with 144 yards on 25 carries.

Harbaugh and the 49ers (8-8) reached a mutual agreement to part ways, but he wouldn't say what is next. According to unconfirmed reports, he is headed for the vacant job at his alma mater, Michigan.

"It's bittersweet," Kaepernick said. "Coach Harbaugh's the coach that drafted me, he's the coach that chose to start me, he's the coach that stood behind me through everything."

Kaepernick said "most definitely" he can lead the Niners to the Super Bowl, even under a new regime.

Harbaugh departs with one season left on the $25 million, 5-year contract he signed in January 2011. He led the 49ers to three NFC title games and one loss in the Super Bowl in his four seasons.

Asked whether it was his choice to move on, Harbaugh said, "You work at the pleasure of the organization, that's what we all do."

Harbaugh sprinted off the Levi's Stadium field for the final time, cradling the game ball.

Harbaugh spoke briefly on the field to CEO Jed York before the game. Harbaugh said "announcements" will be made.

The Cardinals (11-5) missed the franchise's first 12-win season.