It can't. Consider this connected space $X$ (there's no last vertical line as the limit, so it's not compact):
. That's a closed set, the component of the point is just the point itself, but it's not on the boundary of $A$.
The theorem can be generalized in another way. You can leave out that $A$ is closed, then the closure (in $X$) of any component of $A$ intersects the boundary of $A$. (and I believe it can be proven from your version of the theorem)