For the edification of interested parties, I recount a little Trek lore below.
I love these behind the scenes looks at the inner workings of the Enterprise and Star Trek and its (possible) history.
What I imply may not always be canon, but it usually fits known "facts."
The last PhotoTrek clearly takes place after the episode,
Where No Man Has Gone Before.
Mr. Spock was only described in that episode as "science officer." That was the position he held under Captain Christopher Pike. Actually, maybe even junior science officer to start, but he was there for 11 years before Kirk was given command in 2265, at the start of Enterprise's fourth 5-year mission.
Therefore, Dr. Mark Piper could even have been first officer, or possibly just acting first officer. He almost certainly was Chief Science Officer since he reported as one of the department heads. And with his age, he could have had the rank, and might have even been in the chain of command. I got that impression once from the TOS episode,
The Omega Glory, from a recording made by the Exeter's medical officer, Doctor Carter. The Ship's surgeon was sitting in the captain's chair instead of working in his lab, and during a medical crisis, no less, so why was he there? The recording was a warning about an infection brought up from the planet Omega IV below, which was then currently decimating the crew of the Exeter. Too late to save himself or the crew of nearly 425, since they had been exposed too long and were in advanced stages of the lethal affliction, he warned any new comers to the ship they might yet save themselves by quickly beaming down to the planet, where something was keeping the landing party alive. Then he died. His crystalline remains and uniform were all that were left behind. But he was in the captain's chair in Tracey's absence. Perhaps meaningless in itself, but he did sport the rank of full commander on his shirt, just as Spock did at that time, years after the incidents in
Where No Man Has Gone Before.
NOTE: After
The Omega Glory incident, the USS Exeter (NCC-1672) was towed to the nearest starbase, decontaminated, and given a new crew (so some novels say) and went on to experience other adventures.
In TNG, it was even clearer other personnel might be qualified for and be in the chain of command - other people than you might normally expect, such as counselor Troi and Dr. Crusher. This was not a new practice for the time - just rarely done, and could have been the case even a century earlier. It might even explain why McCoy was on the bridge so often, but I think not, since he often seemed too ignorant of command procedures or information. So he's probably all doctor and not in the chain of command. Mark Piper, on the other hand, could have been much more than just the ship's doctor. The rank designations early in the series couldn't show it - or, rather - a single stripe on the sleeve didn't mean Lieutenant - it meant officer, anywhere from lowly ensign and up to but below captain, who had two such stripes. Later, as the series progressed and things changed and promotions were passed out, Spock would have not one, but one and a half (lt. commander), then later two (full commander), and Kirk's 2 stripes would become 2 and half (though this was always a captain, I think). I doubt Kirk's rank was less than captain in 2265, and he was just called “the captain” of the Enterprise. Old Naval tradition has the guy in charge, regardless of rank, called "captain," but that tradition is now defunct. Regardless, all sources I've seen say his rank was captain by 2265, so they just changed rank designations sometime after that. In this way Shatner/Kirk departs from his model for the role, Horatio Hornblower, whose first full command was given to him when he was still just a commander by rank, but called Captain of his ship, the HM Sloop Hotspur.
Pike's "Number One," his cool, logical, female first officer, may not have played well for the audience, particularly the women some say, though others say that was made up by Gene to justify giving his girlfriend a job, but she held the position of first officer under Pike. Pike eventually held that position under Captain Robert April (First captain of the Enterprise and in command of her from 2245 - 2250, as well as being a man who may have personally known Jonathan Archer before his death), and when April left in 2250, Pike was promoted from commander to captain and given command of the Enterprise. He managed two full tours (two 5-year missions). There are some missing years here and there and things don't always butt up well in the history of the Enterprise, but I think that's just because the ship is often experiencing some down time for repairs or even the occasional refit or the time it takes to replace massive losses to the crew. There may have been 2 or 3 years between Pike leaving and Kirk taking command, for example, during such a refit, or less if some of that earlier down time didn't count against the 5-year mission time. If so, it's likely Spock may have overseen the refit and held other jobs in spacedock until Kirk's arrival in 2265. Scotty, 8 years older than Spock and 11 years older than Kirk, could have been there, but even if he were, his rank was either lower than lt. commander at that time, or Spock was promoted to lt. commander before Mr. Scott, giving the vulcan seniority. Most likely, however, Scott was assigned to Enterprise after Pike had left, perhaps during the refit, or near the same time Kirk took command.
Anyway, Pike's number one had a thing for him, and so when he received promotion to fleet captain (which is even above commodore) she probably went with him to his new post, perhaps becoming a captain herself, but maybe just a full commander. If she had stayed with the ship, she probably would have been given command of her, unless her rank still didn't warrant it. If she left, and I think this likely considering her feelings for her captain, then Spock and other lt. commanders may have overseen the refit of the Enterprise. Kirk had more lt. commanders to pick from than just Spock, and didn't have to choose the one with seniority. I think he did in this case, but it's possible some old gaffer with greater seniority was roaming the lower decks where we never saw him. Given the longevity and patience of vulcans, and Spock's prior 11 years of service aboard the Enterprise, however, I discount that possibility.
Kirk's exceptional career and rapid advancement is fairly unusual, achieving the rank of captain by age 32. It usually takes a decade or two longer, even for exceptional one-in-a-million types who can do that job. (Just another reason I scoff at NuTrek that accelerated even that already phenomenal rate, and without a decade of service or experience that made Kirk what he was by 2265, making Nu Kirk captain like that was utterly stupid and too hard to believe, IMO. Scoff).
Anyway, shortly after Pike and his first officer's departure, Pike's accident probably forced their separation, regardless of how she felt. And she may have had her own ship to command at the time, so - the job is the job, and it comes first. There is some speculation she may have been an older relative of Christine Chapel's, which explains the resemblance, but we never do know that officer's real name - only her nickname of "Number One."
Dr. Mark Piper had replaced Dr. Phillip Boyce, but we don't know when, but I'd guess after Pike's first 5-year mission was complete. Then Mark came on board for the second run (and the Enterprise's 3rd mission). Despite two successful missions by captain Pike, they likely had massive casualties each time, for as I understand it, one reason Kirk is so famous is because he was the first captain to complete a 5-year mission with his crew virtually intact, and even he lost just over 50 crewmen, IIRC.
Regardless, Piper was gone after the events in
Where No Man Has Gone Before. I assume he retired or was promoted further and transferred. At any rate, he was gone when McCoy took his place. But by then, Spock had become first officer and chief science officer, and the last PhotoTrek may explain how it happened that way. Regardless . . .
Thereafter on
TOS, Spock wore blue.