I can't comment that squirrels would 1) be so attracted to sunflower seeds that they would bail into a bucket, and 2) not be able to either jump or clamber out of something as small as a 5gal bucket, or at least just stand up in the water to avoid drowning, but I'll share an anecdote on a similar line...
In any farm stock tank (water tank) near trees, most farmers keep some sort of log or post tipped inside the tank so that squirrels could get out if they fell in the water trying to get a drink. If you don't have a way for them to fall out, they can wind up drowning.
So in theory, it COULD work. But again, questions 1 and 2 above are still outstanding in my mind. I'm not sure that you'd get a squirrel to jump into a bucket after sunflower seeds, and not 100% sure a squirrel would drown in a 5gal bucket.