No scientific evidence as of yet supports the fact that male patten baldness is influenced by Vitamin D Deficiency. However, taking vitamin D as a supplement in the required daily dosage is of very little harm and thus cant hurt to take some do correct your deficiency. However it most likely will not help with your hair loss. You should probably discuss with a doctor the medical management of your hair loss.
Although vitamin D receptors have been know to play a role in hair growth in recent studies, there is no scientific evidence that connects patterned baldness to lack of vitamin D at this point.
Vitamin D deficiency is not related to localized hair loss in the crown. In men, the most likely cause of hair loss in the crown, by far is genetic hair loss also called male pattern balding.
The most common cause of hair loss in men is genetic androgenic alopecia. The hair loss is relatively easy to identify because you lose the hair in a "PATTERN". That is why it is also known as Male Pattern Balding.
Balding crown is one of those "patterns".
Vitamin D deficiency is not responsible for the loss of hair in the crown area. It is beneficial to maintain adequate levels of Vitamin D, but low vitamin D will not contribute to focal hair loss. Androgenetic alopecia (male pattern hair loss) is the likely source of thinning of your crown, and you will benefit from speaking with your doctor or hair restoration specialist to discuss ways to maintain or enhance your thinning areas.
I agree with Drs Wasserbauer and Donovan. Vitamin D is important for hair health and growth but a deficiency would caused generalised problems not localised to the crown. Be sure to follow your doctors recommendations to get your levels back to normal as Vitamin D is necessary for healthy bones as well.
Most vitamin deficiencies that cause hair loss (B-12, zinc, iron, D etc.) will cause it in a more diffuse pattern. Crown loss can be many things, but it is most likely male pattern hair loss if you are a guy. If this is the case, finasteride is your number one best friend for keeping the hair (or even regrowing it is you are still pretty young!)
Hope that helps!