I'd use the queryParents method on the repository web service. It will return you all the parents of a node.
There should be a system column called PRIMARY_PARENT which will indicate which of the returned references is to the primary parent of the queried node (if that is what you are after).