I know it's quite basic, but I always get confused between a direct tunnel and a socks tunnel.

So here it is, for later reference:

ssh -N me@myhost.com -L 5000/chat.facebook.com/5222

tunnels requests to localhost:5000 to chat.facebook.com:5222. This is a static tunnel. The following is a generic tunnel:

ssh -ND 8888 me@myhost.com

This dynamic tunnel (-D) can be used as socks 4 or 5 proxy and thus tunnel every request.

Resources