When America tuned in to Star Trek on December 29, 1967, it got its first glimpse of tribbles. These small, plush alien beings, which swamped the U.S.S. Enterprise and its brave crew, were merely sewn-up pouches of synthetic fur stuffed with foam rubber. But in the fictional Trek universe, tribbles were cute, purring, alive and—because they bred so rapidly—hilarious.

Fifty years after its small-screen debut, “The Trouble with Tribbles” may be the most famous episode of any iteration of Star Trek. It was an unintentional comedy that has delighted generations of fans. Surprisingly, it irritated some of those who helped put it on screen—including Star Trek creator Gene Roddenberry. Mr. Spock himself, Leonard Nimoy, once dismissed it as “frivolous.”

“The Trouble with Tribbles” was the first professional sale for David Gerrold, a 23-year-old California college student. An unknown budding writer in September 1966 when he saw Star Trek’s first episode, he almost immediately began thinking of story premises. One of them drew on his teenage experiences of raising frogs, mice, rats, and fish. “I loved animals,” recalled Gerrold, now an award-winning author of many science-fiction novels and stories, in a recent interview. “But all of those critters died on me.”

So in February 1967, he drew up a proposal for an episode he called “The Fuzzies.”

“My original conception was, ‘Aliens are always scary. What if they’re cute but we don’t realize they’re dangerous? What if you had white mice or gerbils that got onto the Enterprise and got out of control?’ ”

Gerrold envisioned a real ecological disaster. “My attitude was that it would be whimsical but that we would have a serious threat,” he said. Nowhere in his work was there to be found now-classic slapstick moments, like William Shatner’s Captain Kirk getting buried in a mountain of tribbles. Gerrold also imagined the buffoonish and chortling Cyrano Jones, the interstellar trader who introduces the beasties to the Enterprise, as a Boris Karloff type. (“You can just see him stroking it and saying, ‘Can I interest you in a harmless little tribble? . . .’ ”)

Gerrold was trying to stay true to what he called the “gravitas” of Star Trek’s first season. One person who would probably have rather seen that gravitas stay intact was Gene Roddenberry. For all his celebrated humanism and we’re-all-alike-under-the-skin tolerance, he wanted Star Trek to be a straightforward, square-jawed action-adventure. “Gene Roddenberry had no sense of humor,” Gerrold said, “and working with him was a joyless exercise.”