Your solution sounds promising.
I am always interested on new functions. Please make a tutorial for this.
My workaround for this problem with steep objects is to place a object bellow the see level and make it invisible from render. In my example the sphere creates the foam.
Mazak
Google+ Bodo
Nittel