As I had some spare time, I modified filter.inc myself and added a syslog message when certain functions are entered and left.
I also added a parameter to filter_configure() and modified every call I could find to that function to pass some ID, so I can see where the call is coming from. Unfortunately, I just looked for calls in the *.inc files in etc/inc, so I missed most of the automatically triggered calls. I'll see that I can modify the other calls too.
What It reveals is that there are four calls to filter_configure() after the PPPoE connection is (re-)established, so my first guess would be that in rare cases, (the last) two of them overlap because they might be triggered by two concurrently running scripts. So they both clear the table first and then fill them up with the rules. As far as I can tell, that would mean that two scripts execute the line
fwrite($fd, $ipfrules); in filter_configure() concurrently, but even then I'm not sure if this would make ipf mix them up, or if it can handle such a situation...
Here's what I got in my log. No overlaps, everything works fine. I'll just wait for the next incident, which will hopefully show an overlap.
<30>May 9 13:36:43 mpd: [pppoe] IFACE: Up event
<11>May 9 13:36:44 php: ### ENTER filter_configure(undef)
<11>May 9 13:36:44 php: ### EXIT filter_configure() in SUCCESS
<11>May 9 13:36:47 php: ### ENTER filter_configure(undef)
<11>May 9 13:36:47 php: ### EXIT filter_configure() in SUCCESS
<190>May 9 13:36:50 sixxs-aiccu: Succesfully retrieved tunnel information for Txxxxx
<190>May 9 13:36:50 sixxs-aiccu: AICCU running as PID 1660
<11>May 9 13:36:51 php: ### ENTER filter_configure(int 1159)
<11>May 9 13:36:51 php: ### EXIT filter_configure() in SUCCESS
<11>May 9 13:36:52 php: ### ENTER filter_configure(undef)
<11>May 9 13:36:52 php: ### EXIT filter_configure() in SUCCESS