It does appear you may have the Pianoteq VST on two channels - on the thru so that you hear it play, and then on the Melody in order to playback the recorded midi. this worked fine on my machine, but may be stressful for your system? I suggest you just put default Synth on the thru to lighten the CPU load during recording.
Are you using two VSTi?
No, I am only using Pianoteq VSTi. I have tried using the CoyoteWT and the same problem exists (recording MIDI stopping at random).