I learned a neat trick to connect to ssh to a box over a SOCKS 5 proxy (ssh -D argument) thanks to this post.
ssh -o "ProxyCommand nc -X 5 -x localhost:9999 %h %p" <host>
where <host> is the desired host and localhost:9999 is the address and port of your socks proxy.
It uses netcat (nc) to tunnel the connection through your socks proxy. Neat.