Heresy was a belief which opposed established doctrine, usually religious. A person who held such beliefs was called a heretic.
The teachings of T'Rea were regarded as heresy by the Vulcans, which eventually led to her stepping down from the position of High Master of Gol in 2229. (TOS novelization: The Final Frontier)
Two or three thousand years ago, Bajorans in some areas of Bajor who were branded as heretics by their religion had their hearts ritually cut out while the person watched. (DS9 - Millennium novel: The War of the Prophets)
Believers of the Pah-wraiths were considered heretics. (DS9 episode: "Strange Bedfellows")
In 2268, Corben was branded a heretic by the Inquisitors and arrested. (TOS comic: "Day of the Inquisitors")