Crusher outranked everyone on the ship in the sense that she was the chief medical officer and could order anyone around if it pertained to their health and well being.
Picard and Riker were obviously the top two people on the ship. Having Crusher and Troi holding commanders' pips complicates things as yes, they are commanders in rank but not by full-time position.
Data, who as one of his primary functions aboard the Enterprise was as its second officer, would appear to be the default #3 aboard ship, despite the fact that Crusher was always a commander during the series as was Troi near the end. So its a question of position and context.
Romulans are attacking and Picard and Riker are stuck on the holodeck blissfully unaware as they romanticize about jazz and women with a knockout in a computer generated gin joint: Data is the ideal person for command.
A crazy plague is taking over the ship and incapacitating the crew by basically getting them drunk off their asses: Crusher would be the person to default to in order to cure everyone.
You would, I think, never see a situation where Crusher or Troi would pull rank on Data after his years of experience just for shits and giggles. Note also that Data always, ALWAYS referred to the two by their titles of "Doctor" and "Counselor" and would likely have maintained this formality should they be in command.