i don't know if this will help, or just put the kid in therapy :) with my little guy, we started the big boy underwear and he picked them out. So we said "Ok, don't get Lightning McQueen dirty. He doesn't like that!" and that worked for a while but we had issue with pooping as well.
so he got good at peeing because he didn't like feeling wet, but was scared of pooping. I'm guessing because it feels like something is falling from their bodies. anywho, i told him that if he was going to continue to poop in his pants, he was going to have to wear a diaper again because babies pooped in their pants. Whether this is a good idea or psychological damage? i dont know, but it worked :) and he didn't do it any more.
He did try to hold it in because he was afraid and ended up with a tummy ache. But we just pumped him full of fiber and put him on the potty every hour to try to poop. when he knew he couldn't hold it anymore (glycerin suppositories :) he sat on the potty and I helped him "Push them out". I pulled on his hands and he pushed them out. Once he saw that everything was ok and nothing bad happened....we were homefree and have been doing well ever sense.
Good luck. I know it's frusterating!