@ ello:
I guess you'll eventually get it right with some modifications but it looks promising so far

I've done some research and there are basically three tricks:
- 1. applying dithering to the samplers since using a low sampling rate of the occlusion will cause artifacts. In your case, this could solve the edge bleeding issue.
- 2. blurring the AO term and storing it in an occlusion map.
- 3. create two passes.
3.1 pass one ; rendering the scene normally.
3.2 pass two ; full screen quad pass to compute the ambient occlusion at each pixel and use it to modify the already computed lighting from pass one.
Might be hard to achieve though but I guess this is logic since it's a next-gen shader effect

Edit:
handy article about SSAO
Cheers
Frazzle