Gorham’s Dan Foley got caught with his pants down on “Survivor” Wednesday night.

Actually, they weren’t just down, his underpants were actually stripped from his body by a wave and washed into the ocean.

But being the resourceful Mainer that he is, Foley fashioned himself a new pair of undies out of his shirt. The new undergarments looked like a loose-fitting diaper and immediately drew smirks and snickering from his competitors.

“I don’t think it was an accident. I think Dan thought this would be entertaining, to be the guy who lost his pants,” said Lindsey Cascaddan, a hairdresser from Florida. “But the joke’s on him. Next tribal council, we’ll send his sweet ass home.”

With or without pants, Foley will continue to be seen on the CBS show for at least another week. The 48-year-old postal worker helped his “Blue Collar” tribe win an immunity challenge by swimming with buoys in tow (pretty easy stuff for a Mainer.) So when one person was voted off the show during tribal council, which happens every episode, neither Foley nor anyone in his tribe was sent home.

Now there are 16 people left in the hunt for this season’s $1 million prize on “Survivor” and Foley is one of them.

Foley was the center of negative attention for the second week in a row Wednesday night, during just the second episode of the current “Survivor” season. In the first episode, competitors said he “didn’t belong” because of his loud and sometimes abrasive style.

Wednesday night’s episode showed Foley telling his tribe mates that he was “doing his business” in the ocean with his underpants around one leg, when a wave took them away. Few seemed to believe him.

This season of “Survivor” was filmed last August and September in Nicaragua over 39 days, so Foley has some idea how far he progressed, though he’s contractually required not to say.

Other than losing his undies and getting some smirks from other castaways, Foley wasn’t seen getting into much trouble Wednesday. And as long as the producers keep staging Mainer-friendly challenges involving swimming in the sea and towing buoys, he might do well.

He is, after all, a man on a mission. He has been trying to be on the show since its first season, in 2000, and had applied more than 100 times. On the season premiere last week, Foley said that he was on the show to “live my dream” and that he’d be remembered, “one way or another.”

The next episode of “Survivor” will air at 8 p.m. March 11. The finale will be sometime in May.