When I try to export custom data from the front-end and export a contact reference I get the name of the contact rather than the id. But when I try to do the reverse and import an organization with some custom data(one of which is a contact reference) the front-end demands an ID. Is there a way to fix this?
I see, you're right.
It would make sense that the export would have a contact reference be part of the "related contact info". Unfortunately that is not the case at this moment.
The best way for you to approach as I see it is to do the export via the CiviCRM API. It is more cumbersome to use (if you are used to using the front-end), but it has more flexibility and more possibilities.
For more info, look https://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API