Probably the biggest contributing factor to the stability of a molecule is the strength of the weakest bond. Peroxides are notoriously unstable, but that's because the O-O bond is so weak. Gasses as a product can sometimes be used as a guide to stability, but it doesn't always correllate. The problem with this is two-fold:
1. Many very stable explosives (like TNT, TATB, etc.) form gasses upon decompositon (explosive or thermal). If you just looked at these and said "They're unstable because they produce lots of gasses" you wouldn't be correct.
2. A few strange explosives (like cuprous acetylide) are very unstable but do not produce gasses upon explosion. This debunks the idea that things that do not form gasses upon decomposition are stable.
Generally, all it takes is the weakest bond to break in an unstable molecule, and then the entire thing goes. This is, of course, talking about explosively unstable molecules. This generally means that the molecule has a high amount of energy to begin with.
If you want to talk about other highly unstable but non-explosive molecules, you can look at a lot of Pt and Pd catalysts, and other weird stuff like certain boranes and borohydrides. There's a ton of highly unstable organometallic molecules that simply 'die' as we say in chemistry. They become unreactive and turn into junk. This again usually comes from them being reactive because of weak bonds or the small amount of energy needed to promote some electrons to an excited level where they can rearrange the molecule or some such.
And, for nitrogen triiodide, no one really knows the structure. It's debated whether it's nitrogen triiodide or ammonium triiodide.