I'm not able to answer your question properly, but I would post some thought about it anyway...maybe they can help.
Z-depth is a pass that stores the height information about what the camera sees.

This pass can be used to fake a lens blur effect. What has the empty's same z-value is in focus, while the other object are blurred. I might be wrong, but I think that the defocus node does not consider wich face is in front of another, but set only the amount of blur by the face z-depth

In the image above, the grey grid is the background. It has no geometry, so it has no-z informations. When the red square is blurred onto, it has no issue, there is nothing behind.
When the red square is upon the white rectangle, which is a face, and has z-info, there is a conflict in the contended area. The border pixel of the square must be blurred, so they should go upon the white square, but at the same time, that pixel should be white and in-focus, so the blur is not visible anymore.


One way to avoid this difference on the border blur is to remove the background from the view by adding a plane behind the white rectangles. You could also achieva a similar result by tweaking z-depth channel with nodes... But while we have obtain a consistent behaviour, I think that is not probably the desired one.
What you probably want is a blurred image upon a not blurred one. One way could be to separate objects in different scene, apply the node only to the geometry you know above and than mix them with alpha over node. But this is not a good solution for an animation.

A second option could be to switch to Cycles render. With his path tracing abilities, you don't need to fake the lens effect, but you can obtain a physically belivable behaviour, at the cost of longer render times.
