Yeah I would say you need to render the scene and keep the depth buffer - in OpenGL you can use it as a depth texture. Then use that texture to draw a full-screen quad while using a shader to modify how much blurring occurs based on distance from the camera/depth values. It's a bit of a fake but it does approximate the concept.
Personally I think that doing depth of field is a bit pointless. The human eye focusses on a particular distance away in a scene, and while you are focussing your attention there, objects nearer/further away will be blurred - BUT you don't see the blurred objects because you only see what you're focussing on. What you focus on is always IN FOCUS. This connection is broken when you try to add depth of field to an flat image because now there is no connection between what object you're looking at and how focussed it is. Thus you now look at the background and see blurry images, whereas in real life if you looked at the background images they would come into focus. So it's kind of dumb, it's just a novel artistic effect at best.
Personally I think that doing depth of field is a bit pointless. The human eye focusses on a particular distance away in a scene, and while you are focussing your attention there, objects nearer/further away will be blurred - BUT you don't see the blurred objects because you only see what you're focussing on. What you focus on is always IN FOCUS. This connection is broken when you try to add depth of field to an flat image because now there is no connection between what object you're looking at and how focussed it is. Thus you now look at the background and see blurry images, whereas in real life if you looked at the background images they would come into focus. So it's kind of dumb, it's just a novel artistic effect at best.