The GPU implementation of the Use Alpha option of the Z Combine node only worked if the first image is closer, since it sampled the alpha channel from it and used it for mixing. Instead, the mix factor should depend on the closer pixel, like the CPU implementation.