After Effects Production Bundle has a plugin-designed to do just that;
The trick is you have to render an .RLA sequence with the depth embedded in the picture, you can then use the effect 3D Channel->Depth of Field.
Another way is to use the “Compound Blur” effect, it takes as the first argument a layer (choose your grayscale Z-layer), and then applies a blur from 0-maxBlurValue based on the brightness of the layer.
Black pixels get no blur, white maximum blur.
If you want to “shift the focus”, you should precompose the greyscale layer and put a curve on it, something like an inverted solarize:

This will map black and white to white, and 50% grey to black, so you get a focus in the middle of your depth.
Alter the curve to fit your need
the grey-layer has to be in sync with the RGBA render in the timeline, but does not have to be visible.