I had same issue with Info-path 2007. Exact same code was crashing with the above error and also Error 5566 . After lots of survey it turned out there is a problem with info path 2007.
I suggest to upgrade to info path 2010. In my case the stability issue was 99% resolved. I still do get crashes but by far less that before.