Realistically command would go to a Ro, a line ensign, before a medical officer. On the same principal that a senior line officer would not give the medical officer orders on patient treatment: Their expertise is in completely different areas.
And that reasoning gives some credence to the fact that the engineering noncom O'Brien can address the somewhat engineering-illiterate officer Ro with "Up yours, suh!" so many times without consequences... It's his field of expertise. Troi's mediation of the situation keeps Ro from simply gagging O'Brien and proceeding with ship separation - mediation and authority in "human relations", not command authority.
It's not a complete train wreck of a storyline, IMHO. It just happens to be based on a train wreck situation.