Courtland Gray, COO of Peavey Electronics, goes undercover. (Cliff Lipson/©2014 CBS Broadcasting, Inc.)

Once upon a time, “Undercover Boss” was one of those reality shows that seemed okay. Sure, there was the standard queasiness watching people get tricked on television, especially as a CEO disguised himself as an everyday worker to get insight into the company. But at the end, when things went well, the boss revealed all — and generally gave out raises, promotions and/or cash money to undervalued employees. Tears all around. (The happy kind.)

It appeared to be a win-win for the company (free publicity!) and CBS, which enjoyed great ratings and Emmy wins for best reality show. But this season, after multiple controversies, it’s becoming clear that the show could also be a liability for employers everywhere.

[Related: “Undercover Boss" CEO awards employee with breast implants in controversial episode]

Take Sunday’s episode, which sent the featured company — Peavey Electronics — scrambling into damage control mode on Monday. In an ominous sign, CBS issued a statement before the episode aired indicating that something had gone horribly wrong after filming.

“Most of the stories we’re lucky enough to tell on the series are inspirational, and many times conclude with the boss offering life-changing rewards for the hardworking frontline employees,” executive producer Stephen Lambert wrote. “Sometimes stories don’t end so perfectly, and we present those to the audience as well.”

It all started when Peavey Electronics, an audio equipment manufacturer based in Meridian, Miss., sent its chief operating officer, Courtland Gray, to check out how things were going in the company. While it thrived in the music industry boom of the 1970s and 80s, business has struggled in recent years. The executives stressed that they didn’t want to outsource jobs overseas, but had to make some changes to operations — so Gray put on a wig and colored contacts and set out to investigate undercover as an employee named Kyle.

During his tour, Gray stopped in “Plant 3” to chat with Thresa, a circuit board technician who worked at the company for 24 years. She filled “Kyle” in on all the cutbacks at Peavey over the years: Shifts cut to four days a week. Rising health insurance costs. Vacation chopped from three weeks to two weeks. Tuition reimbursement ended. Another employee, Michael, had a similar story. He was no longer making enough money to support his family, so he had found a much higher-paying job and given his two weeks notice that day.

So during the grand finale of the episode, “Kyle” revealed himself as Courtland Gray. As inspirational music played, he gave Thresa $5,000 to pay off her student loans; $10,000 to continue her education; and allowed her and her husband (also a Peavey employee) an extra week of vacation. As for Michael, Gray offered him $10,000 to pay off his loans, as well as $5,000 to start a college fund for his kids. About that other high-paying job? Gray asked if they could “work together” to find a way to keep him at the company. Michael happily agreed.

“I’m just glad you’re not going to fire me when I get back,” Thresa said, clearly relieved after learning she was there for a reality show.

“There was no light at the end of the tunnel before, now there is,” Michael said tearfully.

So that only spells impending doom, right? Cut to a message on screen: “FOUR MONTHS LATER,” in fall 2014. Sure enough, things are in shambles. Peavey Electronics indeed closed down Plant 3 to outsource jobs. Employees including Thresa and Michael were all given 60-days notice. Thresa’s husband kept his job, but it was unclear how long that would last. At the last minute, Michael was offered another job in Peavey; though he was seething that he turned down his other, higher-paying job in order to stay a company that wanted to lay him off anyway.

“I feel like I was done wrong,” Thresa said.

“I’m a little bitter,” Michael added.

While social media erupted with criticism, Peavey posted a long statement on its Facebook page (“Unfortunately, there was no other choice we could make in order to stay competitive in the global marketplace.”)

After hundreds more critical comments, Gray wrote a letter and posted it on the company’s Web site, reiterating how sorry he was. But he also blamed CBS for its editing of the episode. He added that they gave Michael a raise on par with the job he turned down, and  Thresa’s husband was indeed still employed at the company. Plus, another employee featured, Ajay, was indeed in the process of getting his visa, as Gray had promised him.

“We feel the show and network did not portray these issues accurately,” Gray wrote.

Is he surprised? Of course a producer is going to edit and present the storyline for maximum drama. When producers caught up with Thresa, she made a point of saying Gray wasn’t even present when an HR manager came to tell everyone that Plant 3 was shutting down.

But no matter what happened, obviously, that’s not how a company wants to be shown on national television. The episode points to the dangers of going on a show like “Undercover Boss.” While it’s tempting to boost your company’s profile by appearing on a popular reality show, you never know what’s going to happen that can make the whole effort backfire.

This isn’t the first time this season that an episode resulted in controversy. The mayor of Pittsburgh found himself in a public fight over funds he promised to employees while appearing on the show. In December, viewers were horrified when the CEO of Bikinis Sports Bar & Grill gifted one employee free breast implants, and fired another partly because she refused to wear her bikini top on camera. (Though the publicity-seeking CEO himself was likely thrilled with headlines of any kind.)

Chances are, companies will be enticed by the prospect of everything going right, as it does for many of the episodes, and the CEOs look like heroes. Still, this season especially should serve as a warning with reality TV, you never know which way things are going to go — and there will always be producers always ready and willing to point out the flaws.

MORE ON TV

How “The Bachelor” took a creepy turn to make Kelsey, a young widow, this season’s villain