The reason for priority one is unknown....
The September 26, 1966 Final Draft script for "Court Martial" has a bit of dialogue that clarifies the point.
From Scene 3:
INT. STONE'S OFFICE
FEATURING chart with legend: STAR SHIP STATUS
lettered: Major Maintenance...Minor Maintenance...Ships
[continuing his Captain's Log]
A full report of damages was
ANOTHER ANGLE - STONE
A NEGRO, whose bearing marks him as a man accustomed to
command. No longer a flight officer, his uniform is some-
what different from Kirk's, who is sitting opposite.
...the Portmaster of Star Base
11: Senior Captain Stone.
I can't possibly have the
ready that fast.
Kirk, who has been reading a document, looks up.
This is not
a scheduled layover,
sir. I have a patrol course to
get back on.
Can they wait?
If you exercise your
Consider it exercised.
Stone nods. He pushes button on desk.
Maintenance Section 18.
SOUND OF CLICK.
(a look at
Your section is working on the
is on Priority One.
Stone clicks off the communicator. Nods at the paper Kirk
has been studying.
That makes three times you've
reac it, Captain. Is there an
(...and then the scene continues on as we know and love.)
So it looks like, generally, you make an appointment to get your starship fixed (or upgraded, I suppose) on a scheduled
layover--in which case it's probably first come, first served. But if you have an unscheduled
layover, then they'll try to squeeze you in if they can. But if you exercise your "Mission-in-Progress
" prerogative because you really need to get back to your patrol route and you just can't afford to be "fit in" to the schedule, then you are made a Priority One and get triaged to the front of the line.