We report on a successful implementation of a three-dimensional wavelet-based solver for the Poisson equation with Dirichlet boundary conditions, optimized for use in particle-in-cell (PIC) simulations. The solver is based on the operator formulation of the conjugate gradient algorithm, for which effectively diagonal preconditioners are available in wavelet bases. Because of the recursive nature of PIC simulations, a good initial approximation to the iterative solution is always readily available, which we demonstrate to be a key advantage in terms of overall computational speed. While the Laplacian remains sparse in a wavelet representation, the wavelet-decomposed potential and density can be rendered sparse through a procedure that amounts to simultaneous compression and denoising of the data. We explain how this procedure can be carried out in a controlled and near-optimal way, and show the effect it has on the overall solver performance. After testing the solver in a stand-alone mode, we integrated it into the IMPACT-T beam dynamics particle-in-cell code and extensively benchmarked it against the IMPACT-T with the native FFT-based Poisson solver. We present and discuss these benchmarking results, as well as the results of modeling the Fermi/NICADD photoinjector using IMPACT-T with the wavelet-based solver.