I had remember "accidents" around that age. Two of them were on the first day of school. Once in kindergarten, once in 2nd grade. Both times I had a nervous tummy and what felt like gas. As I was trying to quietly pass gas, guess what???
There was definitely more to it that gas. I was mortified both times. The 2nd time I was 8!!!
I get irritable bowels to this day when I'm nervous or under alot of stress. Luckily I know now what the deal is and always go to the bathroom to be on the safe side. LOL. I'd probably still poop my pants occasionally if I took the risk of saying "it's just gas."
I'd be inclined to say it is nerves. My mom just talked to me about it and asked me if I had a nervous feeling and a gassy feeling when it happened. Then she told me she got the same thing, and that if I felt that way, I might need to go to the bathroom just to make sure there was nothing else there.