They did it against their will.
They did it against their better judgement.
They did it even though they didn't want to.
They did it under duress.
They did it even though they knew it was wrong.
The above mean slightly different things, but in context are all fine.
We simply don't say "against one's heart", and "in heart-cons" just doesn't exist.
- For Teachers