Popularized by a video of a radio broadcast at a college. A guy was asked at the last moment to fill-in for the normal sportscaster and was given a poorly written script that did not match any part of the replay video, yet he stuck it out. The segment was so ridiculously fubared* he ended with, "and boom goes the dynamite."
Refers to being involved in a situation where everything that can go wrong, does, yet sticking it out until, inevitably, the dynamite goes off (which itself is a reference to movies where, no matter what, the bomb goes off.)
For usage, I suggest you search Google for the phrase to see it in context. You'll find that search here.
*fubared = fucked up beyond all recognition (in the past tense). You can also use "fouled up" in politer company.