Dunn scored his third touchdown with 48 seconds remaining and the Buccaneers clinched a playoff spot, outscoring the Rams 38-35 Monday night and leaving St. Louis needing help to make the postseason.
Marshall Faulk scored four touchdowns for the Rams, but it was not enough in a rematch of last season's NFC championship game won by St. Louis.
To reach the playoffs, the Rams (9-6) need to beat New Orleans next Sunday and hope Chicago pulls an upset at Detroit.
After Torry Holt's 72-yard touchdown catch from Kurt Warner gave the Rams a 35-31 lead with just over five minutes to play, the Buccaneers rallied behind one of the craziest plays of the NFL season.
From their own 35, King threw a swing lateral to Dunn around the right side. But Dunn was trapped far behind the line and, with nowhere to go, suddenly pitched the ball back to King.
King escaped and streaked down the right sideline for a 15-yard gain, and 15 more yards were tacked on for a late hit called on linebacker Mike Jones.
"Shaun was just calling for the ball. We were desperate at the tie," Dunn said. "It turned out to be a great play."
Later, on a fourth-and-4 in Rams' territory, King scrambled for a first down. King then threw a 22-yard pass to Reidel Anthony, which set up Dunn's 1-yard TD run.
Warner tried to bring back the Rams, but threw his third interception of the game. John Lynch's pickoff gave the Buccaneers sweet revenge from last season's 11-6 loss in the NFC title game.
Keyshawn Johnson caught two touchdown passes and Dunn rushed for more than 100 yards for the third time in four weeks.
Faulk scored four touchdowns for the second straight week and third time this season, breaking the NFL record he shared with Jim Brown.
Warner completed 20 of 32 passes for 316 yards and two TDs.
King, who led the 13-play, 80-yard drive to win the game, completed 18 of 38 passes for 256 yards. His TD throws of 8 and 17 yards to Johnson, who had seven catches for 116 yards, were Tampa Bay's first touchdown passes in five games.
Dunn finished with 145 yards on 22 carries. He scored on a 2-yard run in the first quarter and his 52-yard burst on the final play of the third quarter gave the Bucs a 31-21 lead that their proud defense couldn't hold.
St. Louis pulled within 31-28 on Faulk's 9-yard run. Dexter McCleon's interception in the end zone stopped Tampa Bay from scoring what might have been a clinching touchdown before Warner and Holt teamed to give the Rams their first lead since late in the second quarter.
The loss to the Rams in the title game prompted several major changes for the Bucs in the offseason.
Mike Shula was fired as offensive coordinator and replaced by Les Steckel, who helped the Tennessee Titans reach the Super Bowl against St. Louis. The offensive line was overhauled with the addition of free agents Jeff Christy and Randall McDaniel and Johnson was obtained in a trade with the New York Jets.
But until Monday night, the Bucs had used their star receiver as mostly a decoy and Johnson's frustration was beginning to boil over.
King missed him on a fade pattern near the goal line after Ronde Barber intercepted Warner on the Rams' first possession. Tampa Bay settled for Martin Gramatica's 35-yard field goal, and built a 24-14 halftime lead.
Faulk scored on first-half runs of 2 and 16 yards for the Rams. He caught a 27-yard touchdown pass in the third quarter.
Warren Sapp sacked Warner twice, giving the 1999 defensive player of the year 15.5 on the season.
©2000 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed