Sounds like a bad coilpack? I think there is a TSB out on the '99 coilpacks, so you might be able to get some assistance from Mazda on that one.
Then again, it might not be. My '99 has the original coilpacks at 92k miles, and the only problem I have is the occasional stumbling idle when its cold, but it's never thrown a CEL for it.