I wonder if loyalty is the right word for describing Jeremy's behavior. I felt like his refusal to testify against the "brothers" had more to do with his own feelings of guilt and self-loathing because he did not step in to save Sam. I think he wanted to punish himself and not testifying was the only way he had for doing that. He struggled to accept himself as a gay man and being jailed for that "sin" may have made sense to him.
Should I find myself in Jeremy's situation, I would have no choice but to report my "friends". I don't see it as saving myself. It is a matter of doing what is right. There are some actions that definitely cross the line, and no friendship is worth looking the other way when a person is murdered. Fortunately, like rebajane, I've never been put in this position by my friends.