Surf and Leaf Blade (and other attacks with the same effect) work like this:
When you make the Appeal, if the Pokémon that appealed right before you got 4 or more hearts, yours gets zero. if they have 2 or less hearts, yours gets 6 hearts. If they got 3, yours also gets 3.
What about if you are in position 1? Since there were no appeals before yours to compare it to, you get 3.
What if the Pokémon before you can't appeal, due to Explosion or Hyper Beam earlier? You will get 6 hearts, since they got zero.
--- Now, on a Different subject ---
Concerning being painted -- although I did that long post just to talk about how to do well in the preliminary judging, I did say you could get painted with a higher rating, so I want to explain myself better.
Accroding to
The Ultimate Pokemon Center (the same site I put in my last post), the equation for getting painted depends on both hearts and stars.
First Round Score + (sum of all appeals)*2 = Final score.
The first round score is given in the formula in my last post, which determines stars. Note that red hearts during the appeal rounds are worth 10 points each. This determines the final judging number of hearts. If the Final score is at least 800 points when you win in the master rank, it will be painted.
So, if I bring my first Milotic I talked about in my last post to a Beauty contest, you are right, it will need at least 5 hearts. However, if I bring my second Milotic, it will need an extra heart in the final round to make up for having one less star.