TAMPA, Fla. >> Christian McCaffrey’s season debut was a calming afterthought Sunday once the 49ers escaped with a 23-20, chaotic victory over the Tampa Bay Buccaneers.

Brock Purdy engineered a last-minute drive that left it up to Jake Moody, who made a 44-yard field goal as time expired to atone for three earlier misses. Teammates mobbed Moody as the 49ers improved to 5-4 on the season.

Walking by without immediately congratulating him, however, was Deebo Samuel. After Moody’s third missed field goal of the day, Samuel confronted him near the 49ers sideline, long snapper Taybor Pepper intervened, Samuel’s left hand took a swipe into Pepper’s throat, and coaching assistants intervened to separate them.

“It’s an emotional game. Stuff like that happens all the time,” Moody said. “You just move past it. We won, so that’s all that matters.”

Moody missed the previous three games with a high-ankle sprain to his right (kicking) leg. He attributed Sunday’s three missed kicks — from 49, 50 and 44 yards — more so to changing winds before he adjusted the game winner.

As for whether Samuel, a team captain, adjusted his attitude and offered an apology to him or Pepper, Moody replied: “There doesn’t need to be. It’s the heat of the moment. It happens. I do have to make those kicks at the end of the day. That’s all I’m focused on, not anything like (an apology).”

Samuel said he’d eventually talk to Moody, and that he “wasn’t saying anything crazy” after the third miss, other than acknowledging a heat-of-the-moment frustration that drew him “out of character a little bit.”

Pepper said he and Samuel hadn’t yet talked as their lockers were on opposite sides of the room, and Samuel shrugged off Pepper’s vocal displeasure by noting “he wanted to be big bro.” Coach Kyle Shanahan did his best to downplay the rare yet explosive confrontation, simply suggesting that “brothers scuffle” and that any hard feelings would be fixed by the time their flight lands in the Bay Area.

It didn’t have to be such a close game, only it was as the 49ers defense failed to hold a fourth-quarter lead and earlier special teams miscues opened the comeback door for Tampa Bay (4-6).

Purdy completed all four of his passes on the winning drive, two apiece to Jauan Jennings and Ricky Pearsall.

Earlier in the fourth quarter, Purdy threw an 11-yard touchdown pass to George Kittle in the back left corner of the end zone to give the 49ers a 20-17 lead midway through the fourth quarter against the undermanned but gritty Bucs. Purdy scrambled around this Florida swampland before eventually throwing to a familiar spot, where Kittle also made a remarkable touchdown grab in the 49ers’ Sept. 29 win over New England.

The 49ers let another fourth-quarter lead slip away this season, however, as the Bucs pulled even at 20 on a last-minute, 26-yard field goal from Chase McLaughlin. Keying that drive was a dumbfounding barrage of defensive penalties, on Rock Ya-Sin (holding), Fred Warner (facemask), Maliek Collins (roughing the passer), and Evan Anderson (illegal hands to the face).

McCaffrey’s season debut undoubtedly enhanced the 49ers’ offense, as he totaled 68 receiving yards (six catches) and just 39 rushing yards (13 carries). Purdy passed for 353 yards and two touchdowns with no turnovers. Baker Mayfield had just 116 yards for the Bucs and got sacked twice, including on a third-down play in the fourth quarter by Nick Bosa, who battled through a right-hip injury.

The Purdy-McCaffrey combo showed up best a few snaps before Kittle’s touchdown: McCaffrey raced down the right sideline past linebacker Lavonte David and caught a 30-yard prayer from Purdy, who unloaded that pass just before getting drilled in the chest by William Gholston.

The Bucs’ offense, missing its two best wide receivers, relied best on its running game. Bucky Irving opened the fourth quarter with a 14-yard run on third-and-2, then followed that with a 12-yard touchdown dash past six defenders for the Bucs’ first lead of the game, 17-13.

Fellow running back Raachad White scored Tampa’s first touchdown in the third quarter on a 9-yard catch-and-run, tying the score at 10. Setting up that drive was yet another 49ers special teams blunder in a season filled with them. Darrell Luter Jr., who had a punt ricochet off his foot in the Super Bowl, was legally pushed into Jacob Cowing by the Bucs’ Tavierre Thomas, resulting in a muffed punt and a turnover at the 49ers’ 21.

Pearsall’s first career touchdown had put the 49ers ahead 7-0, once a replay confirmed Pearsall’s 46-yard catch-and-run. Pearsall caught Purdy’s pass in stride over the middle at the Bucs’ 30, then beat safety Antoine Winfield Jr. to the left pylon. Pearsall celebrated with Jennings in a choreographed dance, then was handed back the souvenir football from fullback Kyle Juszczyk as more teammates happily mobbed him.

Pearsall, starting his second straight game and playing in his third overall since having his rookie season delayed by an Aug. 31 gunshot wound through his chest from an attempted robbery in San Francisco. On the 49ers’ first series Sunday, Purdy overthrew Pearsall on third down, after Pearsall wasn’t spotted breaking open the previous snap.

The 49ers’ first red-zone opportunity with McCaffrey this season yielded only one touch for him (1-yard run). Purdy followed with consecutive incompletions (to Pearsall and Kittle), setting up a Moody field goal and a 10-0 lead 8:53 before halftime.

Tampa Bay responded with a field-goal drive just before halftime, and, in the process, they lost star left tackle Tristan Wirfs to a left knee injury. De’Vondre Campbell forced that 30-yard field goal with arguably his best play of the season, tackling Irving for a 3-yard loss on third down from the 49ers’ 9-yard line.

The 49ers’ next red zone series saw McCaffrey produce a 7-yard, third-down conversion catch to the Bucs’ 9-yard line, but then he came out for the next two plays. Running backs coach Bobby Turner appeared to hold him back from returning after a one-play break, and instead it was Isaac Guerendo failing to slow a Bucs’ pass rusher on a second-down sack.

McCaffrey appeared to play 56-of-64 offensive snaps and emerged feeling spry, adding: “I thought I was going to be more sore but we’ll see how I feel (today). I never like saying anything like that until you wake up.”

Last season’s AP NFL Offensive Player of the Year, McCaffrey was a game-day scratch before the 49ers’ season-opening win over the New York Jets. He then went on injured reserve while recovering from Achilles tendinitis, a painful condition that led him to seek unspecified treatment or advice in Germany. He officially resumed practicing this past week, reported no setbacks, and came off IR on Saturday.

This being McCaffrey’s debut, it was his first full-speed, full-contact action since the Super Bowl, after which he scathed himself for a first-series fumble in the eventual overtime defeat to Kansas City.

Added McCaffrey: “Just to be out there again, to be honest with you, you realize how much of a privilege it is to play football.”

Moody certainly could relate.

“I knew he was going to hit it,” Purdy said. “It’s just who he is and what he’s done for us. We’ve seen him hit big kicks in his career. To be in that moment, I knew he was the kind guy who’d learn from his mistakes.”