Jesus is the archetype of this character, though he's obviously not the first to have done so. Jesus had the advantage of knowing that there was an afterlife, and that he was going to sit at God's right hand... but He also knew he had to go through infinite pain, Hell.
A divine being helping humanity through self-sacrifice has been an enduring theme in religion and mythology. See Prometheus, doomed to be chained for eternity with an eagle devouring his entrails as punishment for giving mortals the gift of fire. Although he was eventually freed by Hercules after a few thousand years. Legends say that even then, his punishment meant Prometheus had to wear a wreath and a ring of his chains for all eternity- and in respect, humans began wearing wreaths and rings as well.
The Book of Mormon, one of the four parts to LDS ("Mormons") scripture, tells the story of a prophet named Abinadi. King Noah was wicked: he and his priests committed murder and whoredoms and reveled in his riches, among other things, so Abinadi went to King Noah and told him that what he was doing is wrong, and that he needed to set things straight and repent. King Noah and his priests didn't listen and had Abinadi thrown out after warning him not to return. Rather than giving up and leaving, Abinadi returns in disguise and tells him his message again. The wicked priests try to kill him, but find that they cannot, and Abinadi says that they cannot harm him until he has finished saying what he came to say. After he finished, they burnt him to death, and while he is burnt to death, he prophecies that King Noah will also be burnt, which comes true. His death wasn't for naught, however, because one of the king's priests, Alma, listened to what Abinadi had to say, and then ran away from King Noah and repented. He alone helped thousands of people to find God, and many of the people who were righteous because of him converted thousands more.