There is a hereditary disease in corn snakes that has the affected babies acting very weird but usually only when excited - around feeding time or when they fear a predator. These snakes are called "stargazers". It seems to be passed on as a simple recessive gene.
For more info check this out:
The Stargazer Project... - The Source
Discussion...Our Sunkissed Genes (Stargazer/Sfactor gene) - The Source
It seems what your snake is doing is similar but more extreme. There may be other diseases that do this but I can not remember what they might be.
Joanna