The ideal is to remove any piercing or body ring prior to immersion. However, in this case, where you will keep the piercing in for a lengthy interval and its removal could lead to pain or even infection, immersing with it would be permitted.
If there is any safe way to loosen the piercing (so that it is not flush against the skin in front of or behind the hole) without removing it, that would be preferred. You should take care to clean well around the piercing site before immersion, and gently rotate the earring while immersing to allow the water to reach all parts of your ear.
Please discuss this ruling with your mikveh attendant in advance, to mitigate any potential discomfort at the mikveh. You can explain that you have permission to immerse in this fashion from R. Yehuda Henkin, our site's rabbinic supervisor.