PITTSBURGH, Pa. - The Tampa Bay Buccaneers spent nine long days aching for a shot to shake off embarrassment.

Given multiple chances at redemption thanks to the sloppy Pittsburgh Steelers, the Buccaneers didn't let this one get away.

Mike Glennon hit a diving Vincent Jackson for a 5-yard touchdown with 7 seconds remaining to lift Tampa Bay to a stunning 27-24 win Sunday.

The Buccaneers (1-3) lost to Atlanta by six touchdowns more than a week ago but responded by rallying from seven points down in the fourth quarter to give Lovie Smith his first victory at his second head coaching stop.

"I was out last year, so it's been a long time since I've tasted winning a game," Smith said. "For our football team, we needed this."

Did they ever. Only a pair of garbage time touchdowns against the Falcons prevented Tampa Bay from the worst loss in a franchise history littered with lopsided defeats.

The Buccaneers responded with relentless if not exactly crisp play on a day the two teams combined for 22 penalties.

Glennon passed for 302 yards in his first start of the season, including a 41-yard catch-and-run by Louis Murphy that set up Jackson's score.

"We made so many mistakes out there, but we found a way to win," Smith said. "That was a hurdle we needed to get over."

Doug Martin ran for 40 yards and a touchdown in his return from injury. Murphy caught six passes for 99 yards, and rookie wide receiver Mike Evans hauled in the first touchdown of his career before leaving with a groin injury.

Tampa Bay's defence struggled keeping the Steelers in check, though Pittsburgh did its best to stop itself by drawing 13 flags and letting a handful of chances to move to 3-1 for the first time since 2010 slip away.

Ben Roethlisberger passed for 314 yards and three touchdowns, but the Steelers (2-2) couldn't protect a late lead.

Antonio Brown caught seven passes for 131 yards and two scores, and Heath Miller added a career-high nine receptions with a touchdown.

Pittsburgh rallied from an early 10-point deficit and appeared to be in complete control at times.

"We can't go out and expect to beat an NFL team and beat ourselves as well," defensive end Brett Keisel said.

Tampa Bay twice found itself down a touchdown in the second half. Both times the Buccaneers scrambled back.

A 3-yard touchdown run by Martin tied the game at 17 in the third quarter. After Roethlisberger found Miller for a 5-yard touchdown to put Pittsburgh back in front, Tampa Bay kept coming against a Steelers defence that struggled to get to the quarterback even with the addition of linebacker James Harrison.

The five-time Pro Bowler returned to Pittsburgh after an 18-day retirement to help an injury-depleted defence.

Patrick Murray kicked a 27-yard field goal to get the Buccaneers within 24-20. The Steelers tried to go for the knockout punch but couldn't deliver. Roethlisberger found Brown behind the coverage on a flea flicker, but the pass glanced off the Pro Bowler's fingertips.

Tampa Bay responded by driving to the Steelers 14 only to stall. Glennon overthrew Jackson in the back of the end zone on fourth down with 1:53 to go.

"It would have been tough to sleep tonight if we didn't get another chance or win this game because those are throws that I need to make if we're going to win games," Glennon said.

Pittsburgh couldn't muster a first down, giving the Buccaneers one last shot.

Taking over at the Steelers 46 after a 29-yard punt, Glennon hit Murphy in stride. He was finally pulled to the ground at the Pittsburgh 5. Jackson couldn't haul in a pass on second down, but responded on the next play by stretching his 6-foot-5 frame to make the grab.

"I knew Mike was going to give me a chance for a ball on the outside," Jackson said. "I went out there and competed for the ball."

The Steelers were left wondering how they've become one of the league's most undisciplined teams.

"We need to fix it," Tomlin said. "And if we don't we'll continue to lose close football games."

NOTES: Tampa Bay DT Gerald McCoy had two tackles and a sack in his return from a hand injury. ... The win was the Bucs' second in nine meetings with the Steelers. ... Tampa Bay S Dashon Goldson left with an ankle injury and did not return. ... Roethlisberger became the 12th quarterback in NFL history to go over 35,000 career yards passing.