An example of how Brexit could lead to a nuclear war could be this:
Brexit in the UK causes Italy or France to have a similar referendum. Le Pen wins an election in France. Europe now has a fractured EU. The EU, for all its many awful faults, has prevented a war in Europe for longer than ever before. The EU is also a major force in suppressing Putin’s military ambitions. European sanctions on Russia really hit the economy, and helped temper Russia’s attacks on Ukraine (there is a reason bad guys always want a weaker European Union). Trump wins in the US. Trump becomes isolationist, which weakens NATO. He has already said he would not automatically honor NATO commitments in the face of a Russian attack on the Baltics.
With a fractured EU, and weakened NATO, Putin, facing an ongoing economic and social crisis in Russia, needs another foreign distraction around which to rally his people. He funds far right anti-EU activists in Latvia, who then create a reason for an uprising of the Russian Latvians in the East of the country (the EU border with Russia). Russia sends “peace keeping forces” and “aid lorries” into Latvia, as it did in Georgia, and in Ukraine. He cedes Eastern Latvia as he did Eastern Ukraine (Crimea has the same population as Latvia, by the way).