Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.
The only way the sludge bombed wouldnt have KOed, would be if you had 252 EV in Special Def. If you had that EV investment, you wouldve either picked HP or Attack, Plus your bulk up mach punch wouldnt OHKO my defensive heatran. so GG.
Don't worry, hehehe, that happens :) It seemed longer, because we stopped a lot to think. Yesterday I had one that was 60+ turns... it was very veeery long... hehehe.