Hi all, this thread was quite useful because I just had this exact same problem.
I read this thread probably over a dozen times in the past few weeks trying to diagnose this with my mechanic.
It was unclear to me from this thread whether the TCM replacement or tranny rebuild actually fixed the OP's issue since he had both done at the same time....
The TCM replacement fixed my issue....
Here is a summary of my symptoms (this is in hindsight after working on this issue for weeks with my mechanic before taking it to mazda for tcm replacement):
2008 Mazda 5 with 135,000 km (I'm in canada).
Check engine light on, AT light comes on and whole car jerks as it shifts from 2nd to 1st when stopping for a stoplight.
Car jerks again as it shifts from 1st to 2nd.
Every stoplight same thing, whenever it shift from 2nd to 1st or 1st to 2nd same thing.
Now here is the kicker: If I pull over, turn off engine, pull out key, wait a minute, restart engine...AT light goes away and car drives perfectly normally.
for the rest of the day. Until the next morning when it happens again. Every morning. Same thing.
Sometime it would happen at night. Sometimes it happens from Park to reverse. But always every morning it would happen from 2nd to 1st coming to a stoplight.
It almost seems like a crappy computer needing rebooting every day to make it work temporarily...
Scanning the code with my scanner - it is the same code every time:
Code: p0758 Shift Selenoid B Electrical.
Pending code: p0758 Shift Selenoid B Electrical.
Took it to my trusted mechanic. A good guy.
He checked all the wires, seems fine.
Dropped the tranny pan, changed out a new Selenoid B ($210 for the part), changed the fluid using M-V (not mercon V), and changed the filter.
Unfortunately, this didn't do anything...the exact same problem came back the next day as usual.
The next option was to either replace the TCM and/or failing that replace the tranny.
My thinking was that it's unlikely to be the tranny since it shifts perfectly fine after a "reboot".
Mechanic found a used TCM but advised me that who knows what problems it has, and that only mazda could program it.
Best to go to mazda dealer to get a new one and have mazda program it and install it.
Dealer confirmed that TCM does indeed need programming.
They swapped new one in, now everything is fine after forking over $1500 ($1000 for the TCM + 2.5labour + taxes).
Just a comment here that it is really a crapshoot fixing this issue in hindsight.
It could have been the actual Selenoid B. It's what the code says. Duh.
It could have been the wiring.
Lastly it could be the TCM.
Might have been the tranny.
Basically trial and error and eliminate each variable and pay as you go
I don't know if bringing it to the dealer at the beginning would if they would have been able to determine that it was a bad TCM and not a bad Selenoid B. I doubt it and I would have likely payed dealer labour prices to muck around....
Again, crap shoot, and I'm out 2+ grand
At least it wasn't the tranny...
Hope this helps someone.