I've tried using the soft PWM functions in the wiringPi library, but they seem to just use a real-time thread and toggle the GPIO pin from userspace, albeit with memory mapped I/O, so the toggling itself is fast.
(The thread in turn seems to use polling for hand-off when starting, so start time is only precise to about a millisecond.)
The end result is that the tone sounds "grungy."
Would it be possible to write a kernel module/driver that used timer interrupts to toggle the pin? Interrupt latencies may still cause glitches, but it's likely to be less jittery than a thread-based solution.