I remember reading about it here, don't have the article in hand. I'm sure you can find it.
It would have detonated, except that the "fire-safe" switch in the cockpit was not switch to "fire". That switch was just two very low voltage wires running close together, and it was found later that pretty much anything in that bomber could have triggered it. It was extremely lucky that that bomb has not detonated that day.
There were also a few bombs which were lost in fire on the ground, couple of those had their high explosives ignite without producing a nuclear yield but spreading plutonium around, contaminating ground.
There were bombers which fell apart in the air, which crashed, most of the time the nuclear bombs they were carrying survived intact,but a few times those crashes resulted in a widespread contamination with plutonium - a famous one in Spain and another near an American Polar station that the bomber was monitoring from Soviet attack - that one is particularly interesting,because had the bombs aboard that bomber detonated and destroyed that station, it would be extremely likely that the US government would assume that it was destroyed by a Soviet nuclear strike,and not by their own machinery - and that would probably cause them to retaliate starting a nuclear war.