Edit because I didn't actually answer the question.
I do not think that you should delete the data from the users system when they sign out.
I do not know your use case, so I cannot say for sure. But it sounds like, what you really should do, is lazy load your data on request and then cache it locally.
From your question, it sounds like you are eager loading the entire dataset, regardless of if the user needs it all or not.
If you can lazy load (Only load each item when the user requests it), you can create a cache system on the device that will allow frequent access to be quick.
In regards to offline access, I strongly suggest that instead of dealing with situations where Z makes changes after X but Z is online and X is not. If I were making your application, I would strongly push to put the application into a read only offline mode. So if X goes offline, it can read the local data store (or cache) but it cannot make changes or delete records until a connection is established.
This saves you a lot of head aches, and makes your implementation much easier.
Lastly, for detecting changes between the local system and the data in the database, there are two ways to go. Either maintain a modified timestamp on the server for every record. If the record on the system is older, then refresh the cached item. Otherwise leave it. Alternatively you could hash the data, and compare to check for changes. Personally I usually just go the timestamp route, as most items I already want a Created and Updated date anyways.
I hope some of that helps.