Is the domain of an one-to-one function a set if the target is a set? This is probably very naive but suppose I have an injective map from a class into a set, may I conclude that the domain of the map is a set as well?

Define $g$ on the range of $f$ such that $g(f(x)) = x$.  This is well-defined because $f$ is injective. The domain of $g$ is equal to the range of $f$, which is a set. 
Therefore by the axiom of replacement, or maybe the axiom of union applied to $\bigcup_{y\in{\rm Range}f} \{g(y)\} $, the range of $g$ is a set. But the range of $g$ is precisely the domain of $f$.
