The first heading is only used if its available at the time the page is rendered. Although you expired the cache, DokuWiki doesn't do a fresh parse of a page to get the first heading. If cached instructions aren't available, it'll use the raw page name. What you are seeing as inconsistent, is due to the order you have visited pages after expiring the cache.
Chris -- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist