This story had so much potential, but it is sadly wasted.
The superior aliens' motivations and actions are a major problem since they push for sacrifice, compassion and valuing of others, yet mostly fail to display any of the traits they take great pains to test. Then Kirk gives them a stern didactic lecture at the end and they relent a little at the last moment for unclear reasons. The story needed rewrites and a more selfless and competent writer, instead of just messing with the ending. Instead, the writer takes the easy way out and breaks the rule of "show, don't tell" and also seems unwilling to let go of the pet ideas and seems unwilling to "kill her babies." The superior and largely amoral aliens are an obvious Star Trek baby that this episode is unwilling to get rid of or rework. The writer tries playing the aliens both ways (compassionate and not), which really doesn't work well.
The mention of the "pearl of great price" is an obvious biblical reference to a parable of a merchant that gives all his wealth to attain a pearl that is more perfect or precious than all the others. In the parable, the pearl seems to represent salvation through Jesus. The reference simply feels bizarre rather than adding much, but further makes me suspect that Gem (and perhaps the others) is supposed to be something of a Christ figure. Weird and mishandled writing.
At certain other points in the story, the main characters all willingly volunteer themselves for death or insanity in order to save the others. Kirk tells the aliens to take him and let Spock and McCoy go; Spock clearly intends to be the one tortured to spare Kirk and McCoy; McCoy tranquilizes the others so he's the only one available for the aliens to abduct for their next torture and death session. What can you call this willingness to sacrifice for another but love? They don't have to cheese it up, but these should be powerful (but really isn't).
Given the themes and the sacrifices going on, you'd expect maybe this would be the kind of episode that might involve some strong emotions, maybe even make you a little weepy as everyone is sacrificing for the sake of everyone else. It has the potential to be a great episode, perhaps almost on the level of the Next Generation episode "The Inner Light" (though in maybe a slightly different way and with a lot of re-writing and re-conceptualization). Handled appropriately and with skill this TOS episode could be one of the better ones. Instead, it's bungled and doesn't connect to the emotional core and a better plot that could make the episode great.
It's interesting that both hrtonslv and Mac-Ale's reviews seem to be responding to latent potential in this episode. I feel it probably speaks more to their kindness and generosity, rather than the episode. Sadly it didn't live up to the potential which some of us see in it.