in short - entropy of the system with lower gravitational potential is higher (https://en.wikipedia.org/wiki/Entropic_gravity). When oil is mixed into water, the thermodynamic entropy "St,mix" of oil/water system is higher than "St,unmixed" while the entropy "Sg,mix" of the gravitational system of oil/water/Earth is lower when mixed than the "Sg,unmixed" of the unmixed case. In case of bad solubility, like oil in water, we have ["St,mix" - "St,unmixed" < "Sg,unmixed" - "Sg,mix"] and thus system on its own will evolve toward unmixed state.
What about you?
>there is no possibility of deriving equations of motion of mechanics from the laws of thermodynamics
i didn't say that. It actually works the other way - thermodynamics is derivable as an aggregation from the laws of motion. And thermodynamical entropy is just a facet of the entropy (which in general can be defined using relative volume in the space of states of possible configurations of the system for a given values of generic coordinates)