If your variable is on a circle (hours of a day, or months of the year, or directions... or many other possibilities), you should generally use a distribution on a circle for it.
Beside the problem that you have, another problem with setting some arbitrary boundary is that the two ends won't necessarily "meet smoothly" -- you'll introduce a discontinuity at whatever place you choose to break your circle to make it an interval, unless you force the function to be periodic (in which case, you have a distribution on the circle and that's fine).
In the case of nonparametric density estimation, there are periodic kernels and periodic splines that can be used. Another alternative that might be considered is to use mixtures of parametric densities on the circles. [Kernel density estimates could even be regarded as falling into that class, if you see the kernel (with the observation point being a shift parameter) as the parametric density]