Is this a plothole?
In the latter part of the film, it is established that the conspiracy reaches to the high levels of both Starfleet and the Klingon High Command, if this is true then why isn't the following possible?
The Starfleet Admirals involved in the conspiracy would presumably have (or be able to get) access to the Enterprise A's prefix code. This would let whomever they gave the code to access to the Enterprise A's command functions and allow them to alter the photon torpedo databanks from another ship (think Star Trek II: The Wrath of Khan with the shields). If the databanks can be altered from somewhere else, Spock and the rest of the crew wouldn't have been able to figure out what had been going on (or at the very least slow them down enough to not be able to save the Federation President in time).
Our late editor is dead, he died of death which killed him. -John Lennon Daily Howl