Fix is to reorganise footnote code to do as much as late as possible. Then a footnote can be checked against previous footnotes and the id set accordingly.
Update sent via darcs.
Can be seen in action at
http://wiki.jalakai.co.uk/dokuwiki/doku.php/test2