I think the prefix code would have served so much better had it been Khan who used it on the Enterprise. In fact, say it was how Kirk hacked the Kobayashi Maru--he rewrote the Klingon ships to have one. Khan remembers this from reading Kirk's bio during "Space Seed."
Otherwise, it's just a silly deus ex machine. It is quite literally God mode from the machine.