Damon and Pythias endured either the father or the same despotic ruler as Damocles of the sword hanging on a slender thread-fame, which is also in Baldwin's collection. This tyrant was Dionysius I of Syracuse, an important city in Sicily, which was part of the Greek area of Italy (Magna Graecia). As is true of the story of the Sword of Damocles, we can look to Cicero for an ancient version. Cicero describes the friendship between Damon and Pythias in his De Officiis III.
Dionysius was a cruel ruler, easy to run afoul of. Either Pythias or Damon, young philosophers in the school of Pythagoras (the man who gave his name to a theorem used in geometry), ran into trouble with the tyrant and wound up in prison. This was in the 5th century. Two centuries earlier there had been a Greek named Draco, an important law-giver in Athens, who had prescribed death as the penalty for theft. When asked about his seemingly extreme punishments for relatively minor crimes, Draco said he regretted there was no punishment more serious for more heinous crimes. Dionysius must have agreed with Draco, since execution appears to have been the intended fate of the philosopher. It is, of course, remotely possible that the philosopher had engaged in a serious crime, but it hasn't been reported, and the reputation of the tyrant is such that it is easy to believe the worst.
Before the one young philosopher was scheduled to lose his life, he wanted to put his family's affairs in order, and asked leave to do so. Dionysius assumed he would run away and initially said no, but then the other young philosopher said he would take his friend's place in the prison, and, should the condemned man not return, he would forfeit his own life. Dionysius agreed, and was then greatly surprised when the condemned man returned in time to face his own execution. Cicero doesn't indicate that Dionysius released the two men, but he was duly impressed with the friendship exhibited between the two men and wished he could join them as a third friend. Valerius Maximus, in the 1st century A.D. does say that Dionysius released them and kept them near him ever after. [See Valerius Maximus: The History of Damon and Pythias, from De Amicitiae Vinculo or read the Latin 4.7.ext.1.]
Below you may read the story of Damon and Pythias in the Latin of Cicero, followed by an English translation that is in the public domain.
 Loquor autem de communibus amicitiis; nam in sapientibus viris perfectisque nihil potest esse tale. Damonem et Phintiam Pythagoreos ferunt hoc animo inter se fuisse, ut, cum eorum alteri Dionysius tyrannus diem necis destinavisset et is, qui morti addictus esset, paucos sibi dies commendandorum suorum causa postulavisset, vas factus est alter eius sistendi, ut si ille non revertisset, moriendum esset ipsi. Qui cum ad diem se recepisset, admiratus eorum fidem tyrannus petivit, ut se ad amicitiam tertium adscriberent.
 But I am speaking here of ordinary friendships; for among men who are ideally wise and perfect such situations cannot arise.
They say that Damon and Phintias, of the Pythagorean school, enjoyed such ideally perfect friendship, that when the tyrant Dionysius had appointed a day for the execution of one of them, and the one who had been condemned to death requested a few days' respite for the purpose of putting his loved ones in the care of friends, the other became surety for his appearance, with the understanding that if his friend did not return, he himself should be put to death. And when the friend returned on the day appointed, the tyrant in admiration for their faithfulness begged that they would enrol him as a third partner in their friendship.