I definitely agree with shakespeareguru but would like to add that The Winter's Tale falls into the category of Shakespeare's Late Plays, (Cymbeline, Pericles, The Winter's Tale and The Tempest).
All of these plays emerged out of the romance tradition. These plays all deal with loss and gain. They all have "happy"endings.
It would appear that by now, as a writer, Shakespeare has explored comedy, tragedy, and history plays. The romance tradition gave him a new play ground, so to speak, as a playwright. We see him trying things never before done in theatre. The Winter's Tale has what has been called a broken back structure. The first three acts of the play indicate a tragedy. It is dark and wintry, full of death both literally and figuratively. One of the saddest death's was young Mamillius. Ironically, he spoke of the winter time being a time for sad tales.
Shakespeare establishes a beautiful bridge with the Old Shepherd, who tells his son when the youth reports the death of Antigonus, "...Now bless thyself. Thou metest with things dying, I with things new-born..."(Act III, scene 3)
Shakespeare then jumps ahead in time and we get the fresh breath of spring and the introduction of the next generation. Out of death comes life. Both fathers are dead in their own way. Leontes is spiritually dead as a result of his earlier actions. Polixenes is dead to his own feelings therefore he cannot understand his son's love for this "peasant" girl. Florizel recognizes her nobility which radiates from her. (This is similar to the noble radiation of both Marina and Imogen.) Each man has a rebirth due to the innocence and purity of their children's love.
The title of the play operates on a variety of levels which is the beauty of Shakespeare.
I personally think that in the Late Plays, Shakespeare was having as good time as a writer, breaking all the established rules.