I’d still be inclined to use Sonar as the master MIDI clock. That way you avoid potential problems working on the project without the T5 connected.
A couple of questions -
How are you monitoring audio output from the T5? Using Sonar’s audio track echo function or direct from the T5 or via the PC’s spundcard in some way?
When recording MIDI do you have local control on the T5 on or off?
How “out” is the MIDI compared to audio? Are we talking a few milliseconds or a longer period?
Have you tried adjusted the MIDI timing offset in Sonar’s MIDI preferences? If the MIDI is consistently off by a fixed amount that might solve the problem. All MIDI devices take a certain amount of time to convert MIDI into audio and it’s rare to get a perfect match in time between audio and MIDI because of that which is why SOnar lets you adjust for that delay. Usually that delay is a few milliseconds, certainly under 10ms. If you have several MIDI devices it’s almost certain that no two of them take the same amount of time to process MIDI, so some shifting of audio by hand can be necessary to get precise MIDI/recorded audio alignment.