TITLE: when mapping cone is contractible
QUESTION [9 upvotes]: It is quite obvious that if a map is a homotopy equivalence, then its mapping cone is contractible, but is the converse true: mapping cone contractible => the map is a homotopy equivalence? I am thinking about both the topological category and the category of chain complexes.

REPLY [3 votes]: The accepted answer addresses the version of the question for topological spaces. But there is also a positive result for triangulated categories: a morphism $f \colon X \to Y$ is an isomorphism if and only if any distinguished triangle $X \to Y \to Z \to X[1]$ has $Z \cong 0$. See Tag 05QR.
This in particular applies to the homotopy category $K(\mathcal A)$ of chain complexes with values in an additive category $\mathcal A$, which is a triangulated category by Tag 014S. Applying this to the mapping cone in $K(\mathcal A)$ shows that $C(f)$ is contractible if and only if $f$ is a homotopy equivalence.
This also applies to the stable homotopy category of spectra, where it implies that a map of topological spaces $f \colon X \to Y$ with contractible mapping cone is a stable homotopy equivalence.
In examples like David White's answer, you only need to go up to the first suspension $\Sigma X$, by construction (but see also this answer). I'm not sure if something like this is supposed to be true in general, but I'm guessing it's more complicated.