Yes, what you are experiencing is common.
After my first ankle surgery I was bothered by them just when I was about to fall asleep as well (and they were so jolting that they hurt) and I asked my surgeon about it and he said it was normal and would stop in a few weeks. They stopped at about 4 weeks post op for me.
Now, being 7 weeks after my second ankle surgery, I also had them just as I was about to fall asleep, but they stopped about 2 weeks ago.
I still get one now and then but they are random throughout the day.
They will get better as your foot heals. Hopefully your foot is in a split or a cast so it cannot move much when it happens so you won't be in much pain when it does.
Good luck