Dennis Wideman and Mark Recchi also scored, David Krejci added three assists, and Zdeno Chara had two assists for the Eastern Conference-leading Bruins, who snapped a five-game road losing streak Saturday night with a 7-5 victory in Toronto.
Claude Giroux, Mike Richards, and Simon Gagne scored for the Flyers, who had won four of their previous five games.
Thomas was especially effective midway through the second period when he thwarted a Philadelphia two-man advantage for 1:52. A few seconds later, he denied Mike Knuble's attempt from the doorstep.
Antero Niittymaki made 27 saves for the Flyers.
Giroux put the Flyers ahead at 4:56 of the first period, scoring from the side of the net after taking a pass from Arron Asham.
Boston then scored three straight goals to take a 3-1 lead.
Lucic teamed with Michael Ryder on a 2-on-1 rush to tie it at 10:39.
After Wideman scored with a slap shot through a screen with the Bruins holding a two-man advantage at 13:55, Lucic added his second goal at 17:54, scoring from inside the left circle. Krejci picked up his third assist of the period on the play.
Richards made it 3-2 with 2:11 left in the second period when he redirected Ryan Parent's long slap shot for his 29th goal.
Recchi reached around Philadelphia defenseman Braydon Coburn to poke in a rebound of a shot by Chuck Kobasew at 4:21 of the third period.
Skating with the extra attacker, Gagne scored on a goalmouth scramble with 1:12 left in the third period to bring the Flyers closer.