I think this would require a new custom page that works similar to your IPN but does not wait for the IPN post to do it's processing. This is a very custom checkout solution that I do not have specific directions for but the idea would be to transfer the important elements of your IPN page to this new alternative checkout page you have in place. Then when the user goes through the checkout if the total is 0 and they have items in the cart rather than go to PayPal you would have them go to this alternate page that would store the order info into the db and also send out an email. This is just a high level overview and the implementation will be a bit custom but this is the general idea.