OK, apparently this ended up too long for a comment.... (and to see the connection, read the comments above)
It's actually very easy to prove that if $Y$ is locally $\mathbb Q$-factorial (even a little weaker than locally factorial!), then for any point $y\in Y$ in the image of the exceptional set of any projective birational morphism $f:X\to Y$ that exceptional set has to contain a divisor whose image contains $y$, which is a bit weaker statement than that the exceptional set is of pure codimension $1$ (which I bet is what Debarre says in the reference given by Jason and it is also proved in Shafarevich's book), but it already proves Jason's comment (modulo assuming projective) that small (projective) morphisms produce not locally factorial singularities.
The proof (which is kind of fitting your setup) is as follows: Let $H$ be an effective Cartier divisor on $X$ which is not numerically trivial on a curve contracted to $y\in Y$ and consider $f_*H$; if $Y$ is locally $\mathbb Q$-factorial, then (perhaps after restricting to an open subset) some multiple of $f_*H$ is a Cartier divisor. Replacing $H$ with the same multiple we may assume that $f_*H$ is Cartier. Then $f^*f_*H$ is (numerically) trivial on any curve contracted by $f$ and hence by the choice of $H$, they cannot be equal. Therefore $f^*f_*H-H\neq 0$ is an (effective) exceptional divisor whose image contains $y$.
This proof actually shows that if $f$ is a small projective morphism (small means that the exceptional set has codimension at least $2$), then some of your generators on $X$ will likely not end up in the Picard group of $Y$.