I'm only guessing here, but it sounds like someone in the past has taken the easy way out and replaced the 3 wire wall outlet with a 4 wire outlet. Unfortunately there are only 3 of the 4 wires necessary in the wall - what they did to hook it up is impossible to know.
But if you're getting sparking from anywhere something is badly wrong. You need to find out just where those three wires in the outlet are going in the electrical panel and get a 3 wire outlet, properly wired, into the wall, followed by a 3 wire cord to the dryer. It is neither legal nor safe to use only 3 wires to hook up a 4 wire wall outlet.