As to where and how he completed his medical studies, he appears to have begun them at the University of Edinburgh under the renowned Robert Knox; we know this thanks to a memoir of the anatomist Knox by Henry Lonsdale. Stanley's dissection of an elbow took the first prize in 1836 (Sir William Fergusson, recipient of the recently-discovered Stanley letter at the NYPL, was at the time Knox's demonstrator). He then seems to have studied under Fergusson himself, who taught at King's College; although Mike had the College archivist check their Entrance Records, no mention of Stanley could be found, as the volume for the relevant period has gone missing.
Mike has also found that Stanley had two medical publications -- one, in the venerable Lancet, on "Dropsy of the Pineal Gland" (1838) and another "“Case of Perfect Ankylosis of the Five Superior Cervical Vertebrae” in the Edinburgh Medical And Surgical Journal in 1841. All told, his training and published work would seem to have fitted him more for a brilliant career as an anatomist than the more humble one of a Surgeon in the Royal Navy. On joining, he was initially posted to Haslar Hospital, where he was stationed from 5 June 1838 to 11 November 1839.
Just a few months into his posting, on the 10th of November, Stanley seems to have become involved in what, despite the word-mincing of press reports, can only be described as a duel. The cause of this contention is unstated. Stokes Bay is not far from Haslar, and one can imagine that the site was chosen for its shingle beach, which in November one could assume would be fairly sparsely populated.
The following year, he finally joined his first ship, as he was posted to HMS Blonde on November 16th and dispatched to China; Stanley's next few years would be on a series of ships involved in what became known as the First Opium War: the Algerine, the Cornwallis, and the Siren. Although it's often cited as his principal posting, his time aboard the Cornwallis was relatively brief, from June to August of 1842; there, fatefully, he was to meet Le Vesconte and Fitzjames. His service aboard the Siren would have qualified him for a China Medal, but according to Glenn Stein, with whom I checked, there's no indication that one was sent to him or his relations. And, despite all these new bits of information, Stanley's date of birth and parentage remain elusive, as do any details pertaining to his life before he commenced his medical studies. And since, despite his marriage to Mary Ann Windus on the eve of the Franklin expedition's sailing, he never updated his will -- which left his entire estate to one Robert Barr -- no further information can come from that quarter.
The diploma first mentioned does, though, perhaps shed some light on one (since lost) Franklin relic, a board or plank found on Montreal Island and said to have the inscription, "MR STANLEY." It's an oddity of the College of Surgeons that, in order to qualify for membership one must already have completed one's medical studies, and would be known as "Dr. so-and-so." And yet, on receipt of the Diploma, one becomes a qualified Surgeon, yet as such entitled only to be addressed as "Mr."