Just make the Ruler look bad, find some people to conspire with, get the upper hand in the military and wait for an opportunity
Also, make sure to get them by surprise. And find a strawman to be 'ringleader' in your stead, so when you get caught you can sell the others out
(if you're really feeling bad)
The judge idea is pretty simple, but sounds effective. Upto now, that is