(covers information from several alternate timelines)
A Borg cube exploded in Earth orbit when its crew was put to sleep by Lieutenant Commander Data. (TNG: "The Best of Both Worlds, Part II") A second Borg cube exploded during the Battle of Sector 001. (Star Trek: First Contact)
Types of explosions
An antimatter explosion could be caused by a breach of a matter/antimatter reactor or antimatter pod. This loss of containment resulted in an interaction with matter that annihilated both substances and converted them into large quantities of energy in a short amount of time. Antimatter explosions were a serious hazard for vessels powered by matter/antimatter reactors.
In 2258 of the alternate reality, the USS Enterprise was being sucked into a black hole. Montgomery Scott chose to eject the ship's warp cores into the singularity, causing a massive antimatter explosion that safely swept the ship away. (Star Trek)
At some point after 2248, and decades before 2370s, Otrin's species learned of antimatter technology from the Human probe Friendship 1, launched in Earth year 2067. Their early experiments with antimatter particles resulted in a massive antimatter explosion, which rendered their homeworld virtually uninhabitable after experiencing a nuclear winter. In 2378, the USS Voyager neutralized the antimatter radiation, restoring the planet's atmosphere to normal levels. (VOY: "Friendship One")
Anti-matter explosions leave unique, identifiable damage markings. Not long after the explosion of the Yamato, the Enterprise crew identified a Federation shuttle adrift in space with the telltale markings of such an explosion, which Picard was able to identify with only a passing glance. (TNG: "Time Squared")
Forced chamber explosion
A forced chamber explosion was a violent release of energy which could be caused by overloading certain energy-producing technologies.
In 2254, Number One set her laser pistol to overload, threatening a forced chamber explosion, as a means of convincing the Talosians that Humans would rather die than be kept in captivity. This, combined with information they had assimilated from the USS Enterprise's historical records, convinced the Talosians that Humans were too dangerous for their purposes. (TOS: "The Cage")
In 2368, a Romulan science ship experienced a forced chamber explosion in their resonator coil during a test of an experimental interphase cloaking device, resulting in a member of their crew being phased out of reality and the deaths of all but at least seventy-three of their crew. (TNG: "The Next Phase")
Such an explosion occurred in an alternate timeline in the 29th century, when Henry Starling, an industrialist from the 20th century, piloted the Federation Timeship Aeon into the future without properly recalibrating the ship's temporal matrix, resulting in the generation of an unstable temporal field which destroyed all of Earth's solar system in a temporal explosion. This led Captain Braxton to the 24th century, from which the Aeon was accidentally transported to 1967, completing the time loop. This timeline was later negated when the USS Voyager was transported back in time from 2373 to 1996 and managed to destroy the Aeon with a photon torpedo moments before it entered the rift, thereby changing history such that the explosion never occurred. (VOY: "Future's End", "Future's End, Part II")
The Romulan mines encountered in 2152 by the crew of Enterprise NX-01 surrounding a planet annexed by the Romulan Star Empire produced thermokinetic explosions with a yield of approximately one-quarter of a kiloton. Just one of these explosions detonated in contact with the hull when it wasn't polarized was sufficient to destroy a large portion of the ship's port-forward quarter. An explosion of this size was not dangerous at a distance of 20 to 25 meters when holding a hull plate reinforced with duritanium alloy against the blast, such as a shuttlepod hatch. (ENT: "Minefield")