How to render depth pass with alpha channel transparency in cycles?
Yes, you need to use the alpha channel as a mask since transparency is not taken into consideration in the depth pass. 

This is how I have done it:

I used the node called "Set alpha".
I Plugged the depth into te "image" and the alpha pass into the "Factor"
the normalize is optional but helps to see the depth better.