Midi timing suggestion on recorded VST instruments.

okay, so explain this:

I play a Halion4 Piano patch via an M-audio Oxygen49 that is connected to my pc with a USB chord.
I set my audio buffer to 256 samples.
While I am playing I don’t have any noticable timing isseus. So happy camper, let’s play a few bars.

I enable the clicktrack and start playing to the beat, that (to my own judgment) is fairly on the beat.
I hit stop and go in the editor.
Now I see that the whole part is moved backwards in time. Now, latency is a lag of audio or midi right?
So if you have high latency the things you do should apear later in time. How is it possible that what I play appears earlier in the editor?

Can you directly adress this issue Padawan?

Greetz Dylan.