There's not a chance in hell Fox could have possibly had the authority to give Kirk orders or to override him in any way.
Kirk, as captain of the Enterprise, is the absolute law. On the ship, Kirk is, quite literally, God. He's the captain, so what he says, GOES. That's the end of it.
Fox is not a member of Starfleet, he has absolutely no right to order Kirk around in any way. Kirk could have given Fox the gigantic middle finger and there wouldn't have been a damn thing Fox could do about it.
Hell, as much of a pain in the ass as Fox was, Kirk would have been well within his rights to confine Fox to quarters. I'm surprised he DIDN'T do that.
Fox is only an ambassador, nothing more. He carries no legal weight as far as Kirk is concerned. I mean, it's not like Fox is the Federation president or anything like that (under Federation law, the president is Commander in Chief of Starfleet, but Fox was certainly not that). Fox was just trading on his bluster, thinking that this would make Kirk back down. Fortunately, Fox lost.
As far as Kirk's actions towards Eminiar and Vendikar are concerned? It's been said. Kirk was defending his ship against a hostile intruder. He had the right to do whatever he wanted in that regard. The Prime Directive is null and void; Kirk's right of self defense is ABSOLUTE.
Perhaps. But Kirk is not the absolute law on the Enterprise when it comes to the mission it is assigned.
FOX: I have my orders, Captain, and now you have yours. You will proceed on course. Achieve orbit status and just leave the rest to me. You're well aware that my mission gives me the power of command. I now exercise it. You will proceed on course. That's a direct order.
Fox gave Kirk orders which Kirk followed them.
There is also "The Galileo Seven" where GHC Ferris used the mission of rescuing plague victims to order Kirk to abandon search, which Kirk reluctantly obeyed.
FERRIS: So are the plague victims on New Paris. I'm sorry, Captain. I now assume authority granted me under Title fifteen, Galactic Emergency Procedures, and I order you to abandon search.
This is one of the things I like about Kirk. He will ignore rules and do the right thing out of compassion.
But not usually immediately. In TOS, Kirk will try the rules first and only if he saw it was wrong or there was a better way to do it will you see him ignore or bend the rules. YMMV.