Ingo describes how you can use how you can use the console tool "qwinsta" (Query Windows Station) to remotely disconnect a Terminal Services session:
That's the point in time when the console tools "qwinsta" (Query Window Station) and "rwinsta" (Reset Window Station) which are included even with Windows XP come into play. After authorizing at your server (f.e. by connecting to a share, etc.), you can run "qwinsta /SERVER:<server>" to enumerate all window stations and "rwinsta <id> /SERVER:<server>" to remotely disconnect a terminal services session.
This will be very useful for me: when working from home I often do work on my office development machine via Terminal Services and I regularly hit the problem that Ingo describes.