midi recording timing issue

Can anybody help me?
I am experiencing a bizarre timing issue when recording using Cubase Studio 4.
I am aware of latency timing issues but I have a totally different problem.
I am recording using a Roland PC180 midi controller keyboard and playing along with the metronome. There are no latency issues, the sound is produced instantly. When I then play the piece back the timing has shifted and is no longer in sync. The whole track is playing back too early. I can adjust the timing by altering the ‘track delay in milliseconds’ to delay the entire track by 85 milliseconds but I have no idea why it is altering it in the first place.
I had this problem about a year ago when this occurred and got progressively worse the more tracks I recorded and for all sorts of reasons I have not tried since then so today I opened a new project and have just recorded the one track. There is nothing else competing with it, I have just the one midi track recorded and it plays back 85 milliseconds too early.
Anybody got any ideas? - it’s driving me nuts.

You didn’t say if you’re on PC or Mac. If PC, take a look at this article:

Thanks for that, Jarno.
I’m using a PC. Very interesting article - I thought I had problems but it seems others have much worse. I will go through all of the remedies suggested but I seem to have either resolved it or at least gone a long way towards it merely by rebooting (as the article suggests). I do have a habit of leaving the PC turned on for days at a time and the longer it is on the worse the problem becomes. In future I will save the project, turn the computer off and restart every couple of hours. Thanks very much for your help.