Maybe he read up on it before he was removed from the controller position, so McCoys wish comes true and the "universe" now had the knowledge to do brain transplants through's Spock's retained knowledge.Spock is extremely intelligent and I think he has supreme powers of memory retention. Thus, his experience in his role as controller for the vast civilization probably gave him significant knowledge that he'd retain for years to come. I can somewhat believe that... just not surgery to reconnect the brain happening from the top of the head!
Finally something good out of that episode.
