I've experienced the same problem with a Soundblaster Live card (and a XP30). It was a problem with the midi cable. A midi cable is not a simple cable. There is an optocoupler (I don't know if it is the right word in english) inside, and if it doesn't work well, it can make the midi connexion between the synth and the computer work randomly.
Do you have the problem only on recording (does the midi thru function work well ?)