I had the same problem with my son, at the same age. I noticed that when he would go #2, he would go into his room and lay on the floor in front of his guinea pig's cage, and then we'd have a dirty pull-up. I took his training potty in his room, and when he tried to sneak off, I sat him on it, and told him he could poop there. It sounds strange, but it worked. After a few successes, he realized it was okay, and we had no more problems. If he has a favorite peaceful location, maybe you could try something like this. Also, we had great luck with a rewards chart with stickers in the bathroom. After so many stickers, he got a small reward of his choice.(under ten dollars) Maybe this could help?
Mom to Matthew, 11-27-04, and Daniel, 09-10-07