Following a hellish 33-day battle with shingles, David Letterman returned to his show and found it in chaos — rocked by thefts, the loss of longtime staffers and a very unpleasant surprise he discovered in his own office, say sources.

Unknown to Dave, spy cameras had been quietly installed in his office by security officials — and had been in operation for several months.

“Dave absolutely flipped when he learned that these cameras had been put there without his consent,” disclosed a show insider.

“He went ballistic because his young assistants change their clothes in there and were compromised.”

The cameras had been set up to help end a rash of thefts plaguing the show’s headquarters — but that explanation didn’t satisfy a livid Letterman.

“Dave felt CBS security bungled the robbery investigations and betrayed him because they didn’t tell him about the cameras,” said the insider.

“He felt disloyalty from several of the guards he’d hoped would have tipped him off to the surveillance. It made him furious.”

Dave complained, “This place is turning into a prison,” according to a friend.

Ironically, stress can trigger the viral disease that sidelined the star and threatened his eyesight. And shortly after Dave’s return, the pressure on him soared even more as loyal, longtime staffers departed.

After eight years, the show’s Emmy-nominated director Jerry Foley left to work on other projects.

Next a stage manager left. And in a strange twist, it was reported that Letterman’s longtime cue card assistant had “left for personal reasons.” Then just a day later, executive producer Rob Burnett announced, “He’s actually staying.”

Divulged the show insider: “As soon as Dave came back, there were terminations, demotions and reshuffling. Staffers were saying, ‘Watch your back, or you could be next.'”

Adding to the turmoil, Dave has felt betrayed by some individuals, say sources. In recent months, there have been two major robberies in his office. About $6,000 was taken from Letterman’s desk.

An employee that Dave had befriended was questioned and confessed to stealing items from Dave’s pantry, where the star kept bottles of expensive wine, pricey gifts and other items.

“When Dave learned a person he’d trusted and befriended had stolen from him, he was heartbroken,” disclosed the show insider.

But Dave could be a victim of his own generosity to staffers, say sources.

“If you have a problem, he’d lend you money,” revealed the insider.

In recent months some loan recipients have stiffed him on their debts, charged the insider. Divulged the insider: “Dave feels burned. The happy-go-lucky attitude of the old days is gone.”