I finally just stopped showing any emotion when my son would do this...I did make him clean himself up in the shower (and I would turn the water colder than he liked it...not cold cold like freezing but not as warm as he would have liked it). Then he would have to scrub out his own underpants in the toilet and then take them to the washer.
He cried the whole time first time I made him do all of the above...I never got upset, I was just matter of fact this is what you have to do every time you choose to use your underwear for a number two.
The second time he almost caught himself in time to not do it...it was really an accident, not an on purpose poop in his underwear. I followed the same procedure...uncomfortable shower, wash them out in the toilet and then to the washer.
There was NEVER a third time. It wasn't until I made him do the "dirty" work that he stopped. Good luck!!