You have a lot of stuff going on there. I think you need to put your $counter = 0; above if (have_posts()) :
–
Chris_OApr 5 '11 at 3:10

Chris, I deleted my last comment and fixed the code below because I had made a mistake that I hadn't noticed. Moving the '$counter = 0;' didn't have any effect on its own, but changing it to 'static $counter = 0;' and moving fixed it completely. Thank you so much!
–
TimApr 6 '11 at 15:45