By 2268, he had risen to the rank of commodore and was the commanding officer of the ISS Lexington. During a war game held in that year, the M-5 computer was put in command of the ISS Excalibur. It faced off against the Lexington, ISS Enterprise, ISS Potemkin and ISS Hood. However, when it was supposed to use low-powered phasers, it instead fired on the other ships at full power, destroying the Potemkin and nearly destroying the Enterprise.
Using an unorthodox strategy, the Enterprise's captain Spock and his first officer, Montgomery Scott, brought up the datacharts of the command consoles of the other two fully-crewed ships, knowing that M-5 would have changed the prefix codes of Excalibur to prevent what he was about to attempt. He armed the self-destruct package of both the Lexington and the Hood and detonated them when they were in close proximity to the Excalibur, vaporizing all three ships. Wesley was killed in the process, as was his entire crew.
The incident was reported to Starfleet Command as an accident but Spock correctly believed that it was an attempt to assassinate him by his enemies in Starfleet. M-5's creator Doctor Richard Daystrom told Commodore Wesley that his creation could indeed destroy the Enterprise, but had not brought up the possibility that it would turn on them as well. Wesley paid for that mistake with his life. (TOS - Mirror Universe novel: The Sorrows of Empire)