Sound occurs before reaching Midi event

Hi all,
I have just installed Cubase 6.0.7 on new SSD. When I record midi, the timing is spot on but on play back the instrument plays just before the midi event by about 40ms. I have ticked system time stamp on and off and made changes to the latency settings but no improvement.
I have´t found anything on the forum or knowledge base that has helped.
Thanks in advance