Tyler Toffoli and Dillon Dube each had a goal and an assist, and Noah Hanifin had three assists for the Flames (22-16-9), who had lost two in a row. Dan Vladar made 21 saves.
"It was a lot of emotion and a lot of goals," Andersson said. "It was a fun one and a good thing we came out on top."
Steven Stamkos and Anthony Cirelli scored, and Andrei Vasilevskiy made 35 saves for the Lightning (29-15-1), who have lost two straight after winning their previous five, the first three of which began a season-long five-game road trip.
"If we can win five, lose two, win five, lose two, I'll take that all day," Tampa Bay coach Jon Cooper said. "That'll get us home ice (in the Stanley Cup Playoffs). It's just frustrating. To me that's always a successful trip, but when you go 3-0 and drop the last two, it makes it a little sour. But we'll take it. About .500 on the trip, and it puts a little more stress on us at home to do better than that."
Toffoli tied it 2-2 at 12:18 of the second period when his wraparound attempt deflected in off the skate of Victor Hedman, and Andersson put Calgary ahead 3-2 at 17:20 with a wrist shot from the point that deflected off Hedman in the slot and by Vasilevskiy.