We recently had an issue with one of our clients that was causing our app's API calls to Salesforce to fail. Upon further investigation, it seems that the Salesforce server the client was assigned to for logging in via the web was ap1.salesforce.com, but calls to the API to determine the correct endpoint to use were using eu1.salesforce.com. The problem eventually seemed to resolve itself after we requested a new refresh token.
Has this ever happened to anyone else? Not sure how to accommodate for this - we determine the endpoint to use on every API call, we're not storing the endpoint anywhere.