Having a quick look at the definition of \end{center} we see that it just ends a trivlist,
\def\endcenter{\endtrivlist}
now as to why Lamport would use a trivlist to define the centering and indirectly the center macros is a subject for another question, it suffices at this point to just say he was very fond of them, although I am sure he had some valid reasons for doing so.
Changing your code slightly and introducing a trivlist you can observe the effect:
\documentclass{article}
\makeatletter
\newcommand\thisworks{%
$$\ast$$
\@afterindentfalse
\@afterheading}
\newcommand\thisdoesnt{%
{\begin{trivlist}\item\end{trivlist}}
$$\ast$$
\@afterindentfalse
\@afterheading
}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\thisworks
\lipsum[5]
\thisdoesnt
\lipsum[42]
\end{document}
If you uncomment the grouping brackets at the \begin{trivlist} line, you will see the effect. The code is all interwoven in the source2e.pdf.
To understand better LaTeX's buggy behaviour here, I will illustrate it with another minimal:
\documentclass{article}
\begin{document}
This is the normal behavior of a:
\begin{trivlist}\item list\end{trivlist}
trivlist that is not enclosed in a group.
If you enclose the list in a group the lines after the list:
{\begin{center} center\end{center}}
are indented. LaTeX is buggy in this respect.
\end{document}
This results in:

If you group trivlist or the center commands results in the same buggy behaviour.
In your example the latter allows the \@afterindentfalse\@afterheading to take effect as it can apply everypar or indent at the beginning of the paragraph, whereas in the first example above, it can't as the following text is considered the last portion of the previous paragraph.