Code 41 is for the heater in the O2 sensor. Unplug the sensor & use a multi-meter to measure the resistance between the 2 same-color (black?) wires of the sensor. Should be 10 to 40 ohms. If that's OK, then the problem is in the wiring not the sensor. Look for loose/dirty/corroded connections.
Since it comes on coasting/braking, look for anything related to motion of the engine & exhaust pipe which might pull on the wiring. Especially since a mechanic said something about engine mounts...