There was a problem in cubase that many experienced in different ways. For me I think it was midi was out of time by about half a second...
The solution was to find the checkbox in the configuration menu's that said:
USE SYSTEM TIMESTAMP.
Is there anything like that in sonar?