There's a very interesting way of handling complicated, multi-column dynamic sorts
over at john-sheenan.com
I am not sure about the efficiency of this approach, but in general dynamic sorting tends not to be very efficient anyway (unless you use dynamically-created SQL statements). Overall, it is a very clever use of RANK() and definitely worth a look.
Thanks for the great idea, John!