SANTA CLARA, Calif. (AP) — Jim Harbaugh sprinted off the Levi’s Stadium field for perhaps the final time, cradling the game ball. The San Francisco 49ers won for their embattled coach and doused him with a celebratory ice bucket.

Colin Kaepernick threw a go-ahead 3-yard touchdown pass to Bruce Miller late in the third quarter, and Harbaugh won in his likely last game leading the Niners, who beat the playoff-bound Arizona Cardinals 20-17 on Sunday.

READ MORE: Woodland Police Release Bodycam Footage From Drag Event Canceled Over Threats Of Violence

Anquan Boldin caught a 76-yard TD pass and went over 1,000 yards receiving. Frank Gore ran for 144 yards on 25 carries to go over 1,000 yards rushing for the eighth time in 10 NFL seasons with San Francisco (8-8).

The franchise’s all-time rushing leader hopes to return to the only team he has known and the team has publicly expressed a mutual interest.

Not so for Harbaugh, who would depart with one season remaining on the $25 million, five-year contract he signed in January 2011.

Harbaugh spoke briefly on the field to 49ers CEO Jed York before the game amid unconfirmed reports the coach is bound for alma mater Michigan. San Francisco missed the playoffs following three straight trips to the NFC championship game and a runner-up Super Bowl finish after the 2012 season.

The 49ers, plagued by injuries to key players all season, snapped a four-game losing streak, their first under Harbaugh

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

Ryan Lindley threw touchdown passes of 20 and 41 yards to Michael Floyd in the first half, but couldn’t deliver late.

Floyd finished with eight catches for 153 yards. Coach Bruce Arians went with Lindley under center after he originally planned to start rookie Logan Thomas before changing his mind.

Lindley was intercepted three times.

READ MORE: Two Women Rescued While Lost Hiking Shirley Canyon Trail In Tahoe

The No. 5 seed Cardinals missed the division title, too, as defending Super Bowl champion Seattle beat St. Louis 20-6 to win the NFC West and the overall top seed. The Cardinals play at Carolina next weekend.

Lindley threw his first career touchdown pass on his 229th attempt with a 20-yard completion to Floyd on Arizona’s opening drive.

Arians has been optimistic Drew Stanton will be back next week from a sprained right knee that got infected.

Boldin caught a 9-yard touchdown pass that was negated by rookie center Marcus Martin’s chop block penalty. Alfonso Smith also had his short scoring run negated when Harbaugh called timeout. Then came Miller’s TD catch.

Franchise rushing leader Gore provided a bright spot at $1.3 billion Levi’s Stadium, where San Francisco finished 4-4. Gore, with his family in attendance and wearing his No. 21 jersey, became the 11th player in NFL history with eight 1,000-yard seasons and 20th player to reach 11,000 yards rushing.

Phil Dawson kicked a 53-yard field goal early in the second quarter, just clearing the crossbar, then also hit from 37 yards before halftime.

Boldin caught a 76-yard touchdown pass from Kaepernick, the second-longest TD catch of his career. Boldin became the fourth player in 49ers franchise history with multiple 1,000-yard receiving seasons, joining Jerry Rice (12), Terrell Owens (5) and John Taylor (2).

More Stories
[display-posts category=”49ers” wrapper=”ul” posts_per_page=”6”]

MORE NEWS: Incidents On I-80, Highway 50 Clog Traffic Into Sierra Ahead Of July 4 Weekend

Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.