He may have left his heart in San Francisco — but Tony Bennett owes his life to Miss Piggy.

The legendary swine puppet shed her diva-like image and sprang into action when the 90-year-old Queens native, and national treasure, nearly took a spill on a float at the Macy’s Thanksgiving Day Parade.

The crooner and the pink Muppet had just wrapped up a duet of “Santa Claus is Coming to Town” when their float suddenly lurched forward, causing the “Rags to Riches” icon to lose his balance.

Bennett grasped at a replica toy block on his left, while Miss Piggy caught and steadied him on the right — and a national nightmare was averted.

Bennett’s publicist Sylvia Weiner said the Astoria native, born Anthony Dominick Benedetto, is OK. “Tony is great and thanks the crowd along the parade route for their warmth and he wishes everyone a very happy Thanksgiving,” she said.

The “Today” show’s Matt Lauer, one of the parade’s announcers, either didn’t notice the near fall or just skipped over it. Instead, Lauer just plugged Bennett’s upcoming NBC special.

Of course, the ever-watchful eye of social media didn’t miss it.

“I have never seen a more amazing act of puppetry than Miss Piggy somehow catching a falling Tony Bennett,” tweeted Princeton University graduate student Macs Smith.

Others drew bigger conclusions from the wobbly Bennett-Piggy moment.

“Miss Piggy saving Tony Bennett is the best thing to happen in 2016,” observed Gary Pochron, software engineer from Buffalo.