I have to justify why from the equation $x^3-3x+2+ye^y=0$ a function $y=f(x)$ is implicitly defined on $\mathbb{R}$.
When we use the implicit function theorem, do we not get that the above holds in a subset of $\mathbb{R}$ ?
How can we justify that in this case?

It is not.
Note that $y \mapsto -y e^y$ has a $\max$ of $e$, hence if $x^3-3x+2 >e$, there is no value of $y$ that satisfies the equation.
Furthermore, when $x^3-3x+2$ lies in $(0,e)$ there are two values of $y$ that satisfy the equation.
Addendum:
Let $f(x) = x^3-3x+2$, $g(y) = -y e^y$. The idea is that given $x$, we want to find a unique $y$ such that $f(x) = g(y)$.
A small amount of work shows (i) $\lim_{y \to -\infty} g(y) = 0$, (ii) $g$ is strictly increasing on $(-\infty,-1]$, (iii) $g$ is strictly decreasing on $[1,\infty)$ and (iv) $\lim_{x \to \infty} g(y) = -\infty$. Combining these, we see that the only values of $\alpha$ for which $g(y) = \alpha$ has a unique solution are $\alpha \le 0$.
Consequently, we want to find values of $x$ such that $f(x) \le 0$. A small amount of work shows that $f(x) \le 0$ iff $x \le -2$ or $x = 1$.
Hence we can uniquely define a function $h$ on $(-\infty, -2) \sup \{1\}$ that satisfies $f(x) = g(h(x))$.
If we are willing to drop the uniqueness, we can extend the definition, then the domain becomes $\{x | f(x) \le e \}$ which consists of two intervals.