three way switches not working
I'm not familiar with what moving wires and twisting "it" (what?) could mean. But I read there was a spark which should put you on alert. Some connection is no longer fixed. Sparks can cause fire! You don't know what's going on there and obviously you don't know how to handle this situation.

Turn off the fuse or breaker or whatever this is called and find a professional to see this ASAP. An electrical expert looking at that is cheaper than a burnt down house.