Star Trek/Recap/S3/E08 For the World Is Hollow and I Have Touched the Sky
The Enterprise is attacked by what appears to be a normal asteroid, but what turns out to be a cleverly disguised generation ship called the Yonada. The ship is on a collision course for a Federation planet with a population of 4 billion. As the Power Trio beam over, they discover a people from a long-dead civilization. The people still believe that they are on the planet, which was destroyed when the sun went nova, and anyone who learns the truth is killed by the Oracle, actually the main computer of the ship. McCoy, who has been inflicted with a rare, incurable disease that will kill him in a year, begins to fall in love with one of the women of Yonada, and decides to join the ship in exchange for Kirk and Spock's lives when they're caught trying to figure out a way to divert the ship from its course. McCoy himself finds out the way to divert the course, but the trio must fight the Oracle every step of the way to do so. As they do, they consult the civilization's database, which, conveniently, also has the cure to McCoy's condition.