I'm really glad you weren't even more seriously hurt!
I think this is a valuable safety lesson that everyone can learn from!!
*edit* You did the smart thing in removing the spark plug from the wire, but somehow the spark still jumped the distance from the boot to the engine case.
I'll be unplugging (& covering) the CDI wire any time I do something like that from now on!!!