How to get last sales order of a contact?

How to get last sales order of a contact?

I need to get the last sales order placed by a contact in my custom function. What is the best way to get this?