Well all I can say is that they knew they were McCoys freinds and they knew Kirks mavorick personality.
No doubt they may have been warned before hand to keep a eye out on them if they turned up.
I think that's a stretch. Kirk had no maverick personality until the events in question. It was only after TSFS that his reputation as a rule-breaker came to light. Before that, he'd been a respected member of Starfleet, albeit something of a dinosaur.