I have heard about cases (during the period of the late Rishonim) where a Posek or a Beis Din meted out a harsh punishment to an individual for their breach of halacha in order to protect their community from coming close to doing the same aveirah. The case I heard about involved illicit relations, but in any case has anyone heard of such a concept and can you please provide sources/proof?
There are many examples of this, and in fact there is a book devoted to this topic: העונשין אחר חתימת התלמוד--for one example, see e.g., תשובות הרא"ש כלל י"ז סימן ח
I'm not sure if this exactly address ur question properly, but there is a Gemara (Sanhedrin 58b) that discusses lifting up your hand to hit someone (without actually hitting him). According to Rav Huna there, his "hand should be cut off." The Gemara even goes further to say that rav Huna actually did this one time (רב הונא קץ ידא). Now, seemingly this is not a prohibition which would actually require such a punishment, because that is not one of bet din's methods of punishment (moreover, even though rav Huna brought a source from a Pasuk that his hand should be cut, I think we can fairly assume that's more of an asmachta than a Halachic source). So maybe we can explain that rav Huna did this to enforce the rules, etc.
There is an interesting, albeit hypothetical, case in Scripture for this sort of a thing. After the incident with Uriah and Bat Sheva, the prophet Nathan comes to King David (Shmuel II 12:1-4) and relates to him an incident in a parable:
There were two men in one city: the one rich, and the other poor. The rich man had exceeding many flocks and herds; but the poor man had nothing save one little ewe lamb, which he had bought and reared; and it grew up together with him, and with his children; it did eat of his own morsel, and drank of his own cup, and lay in his bosom, and was unto him as a daughter. And there came a traveller unto the rich man, and he spared to take of his own flock and of his own herd, to dress for the wayfaring man that was come unto him, but took the poor man's lamb, and dressed it for the man that was come to him.
The halachic penalty the rich man was obligated in was for stealing and slaughtering a sheep, so he was should've been sentenced to a 4-sheep penalty payment, but instead, on top of the payment, King David sentences him to death (12:5), presumably to set him as an example for the people.