My son wasn't fully potty trained until K. To this day he sometimes still wets his pants. He just gets so preoccupied he forgets to go.
He's also very smart. He does great in everything and really only acts up for me. I think maybe the smarter kids have a harder with the emotional stuff and following directions kind of things.
People have suggested that maybe he's feeding off my moods. Maybe the same thing is happening to you.