What happens to titanium body parts, mechanical hearts or electronic implants when a deceased is cremated?

They survive. A pathologist, pathology assistant or mortician must remove pacemakers before cremation or they explode, which is messy and dangerous. The metal parts may or may not melt; there will be a metallic mass among the ashes.
Destroyed. Unless I am mistaken, they too are destroyed in the fires of the crematorium.