It is pretty easy to check, that if $X$ is $T_1$, then it has to have at least as many open sets as points, because every singleton would be closed. On the other hand, if we don't assume anything about $X$, we could choose indiscrete topology and get positive answer.
In the middle, we have $T_0$. My intuition says, that it shouldn't be possible, but I don't know why.
The proposed by you solution for $T_1$ case works almost the same in $T_0$ case, except you should not focus on singletons, but rather on closures of singletons.
Let $(X,\tau)$ be a $T_0$ topological space. Note that two points $x,y$ are topologically indistinguishable if and only if $\overline{\{x\}}=\overline{\{y\}}$. Thus in $T_0$ spaces $x=y$ if and only if $\overline{\{x\}}=\overline{\{y\}}$. This shows that
$$f:X\to \tau$$ $$f(x)=X\backslash\overline{\{x\}}$$
is an injection, regardless of whether $X$ is infinite or not.