Black smoke means the fuels too rich somewhere, so look for things that would give it too much gas, or things that would restrict the air it can get.
Were you extremely careful with the O2 sensor? that controls the fuel mixture, and they go bad if you look at them wrong, so it might be that. Also certain gasket makers/ sealers can harm O2 sensors. If you just can't figure it out and we can't help ya, try a new O2 sensor. I kinda think the O2 sensor may be involved because you said it didn't make smoke right away. right when you crank up the truck, the O2 sensor doesn't work until its warmed up. so it kinda sounds like when it went out of loop mode, the sensor started telling it to give too much gas.