I checked the code of `org-insert-heading'.

One potential factor: when folded, and putting cursor and the end of heading, the cursor is supposed to be 

:END: (here)

and it's not judged as a heading.


On Tue, Apr 23, 2013 at 2:57 AM, Bastien <bzg@gnu.org> wrote:
I'm tempted to apply the following patch, as this problem falls under
the category of "inserting in an invisible region".  I don't think it
breaks any non-interactive call of org-insert-heading, but this needs
further checking.

Also, note that the problem occurs only when there is no blank line
between the :END: and the following headline, so maybe the real fix
has to be within org-insert-heading...



--
 Bastien