Angus - it still leaves questions as to what is configured, we cannot see what is plugged in at the time you are either running diagnostic tests or when you are doing your audio processing.
So, for the moment, let's try to tackle one interface at a time.
Please for the moment remove your M-Audio card from your system, and disable your Realtek on-board sound, then set your default audio device to be your Line 6 UX2.
Once that is done, please then detail your results running DPC Latency Checker outside of Sonar, and also running it while Sonar is running.
Additionally, please detail your settings for the Line 6 UX2 interface at the time of the above tests. (We need to know Sample Rate and ASIO Buffer Size)
We also need to know what the Sample Rate is set to in Sonar, and the reported Total Round Trip latency for Sonar being configured for the Line 6 UX2 interface.
Could it also be possible that dropouts are occurring due to some project's use of plugins? Sometimes certain plugins can cause dropouts and issues - look ahead processing or CPU-intensive plugins meant for mastering are often the cause for tracking issues.
The above should eliminate confusion for us as to what is running on your system, and perhaps we can figure out how to help reduce any latency on your system.
Bob Bone