A jealous, pistol-packing Johnny Carson — sure that his second wife, Joanne, was cheating on him — broke into her secret Manhattan apartment and found it full of pictures of the other guy: Giants football legend Frank Gifford.

So claims a lawyer who toiled for 18 years as consigliere to the moody king of late-night television until they had a falling-out.

In his new tell-all, “Johnny Carson,” Henry Bushkin writes that Carson hired him in 1962 and that one of his first jobs was to accompany Carson and a private eye to break into a pad Joanne was renting on the sly.

“I have reason to believe my wife is cheating on me,” Carson told Bushkin. “I also have an idea who the son of a bitch is that she’s shacking up with.”

He was talking about Gifford, who would go on to broadcast fame as an announcer on ABC’s “Monday Night Football.”

On seeing the “S.O.B.’s” framed photographs all over Joanne’s pied-a-terre, “Carson leaned against the living room wall and began to weep,” Bushkin writes.

“I realized that I was probably one of the very few people who ever saw Johnny Carson cry.”

Lucky for Joanne, she wasn’t home.

When Carson’s raincoat fell open, “I was shocked to see that Johnny was carrying a .38 revolver in a holster on his hip,” Bushkin writes.

Joanne Carson, now 81 and living on Sunset Boulevard in Bel-Air, California denied to The Post Monday that she ever had an affair with Gifford, saying she had only been pals with the gridiron great.

“Now I do know that Johnny was jealous of him because he knew that he had been a friend of mine,” she said.

Although she called Bushkin’s story “delusional,” she admitted there had been a New York City apartment with some of her things in it — but she said it belonged to her secretary.

She said that although it was possible he broke in, “Johnny never mentioned it to me.”

And the gun?

“Please,” she said. “Johnny would have never carried a gun. First of all, he was terrified of guns.”

Bushkin writes that after his alleged discovery, Carson fled to a bar to drown his sorrows with on-air sidekick Ed McMahon. When Bushkin arrived, he found the liquored-up host turning his humiliation into comic material.

“Why Frank Gifford? What’s that a- -hole got that I don’t have? That guy plays three positions on the field. I could never get Joanne to go for more than two.

“I think I’ll use that in tomorrow’s monologue,” he said.

“Joanne has broken my heart,” he told Bushkin, “to the extent I ever had one.”

Bushkin says Carson left the bar that night with another woman “nearly as famous” as he was.

Carson and Joanne remained married until 1972, the year “The Tonight Show” left New York for Burbank, Calif.

Carson died in 2005 at age 79.

On Monday night, Joanne scoffed at Bushkin’s tale, saying, “He should release it under fiction.”

Calls and e-mails to representatives of Gifford seeking comment were not returned.