Dipole localization, a fundamental challenge in electromagnetic source imaging, inherently constitutes an optimization problem aimed at solving the inverse problem of electric current source estimation within the human brain. The accuracy of dipole localization algorithms is contingent upon the complexity of the forward model, often referred to as the head model, and the signal-to-noise ratio (SNR) of measurements. In scenarios characterized by low SNR, often corresponding to deep-seated sources, existing optimization techniques struggle to converge to global minima, thereby leading to the localization of dipoles at erroneous positions, far from their true locations. This study presents a novel hybrid algorithm that combines simulated annealing with the traditional quasi-Newton optimization method, tailored to address the inherent limitations of dipole localization under low-SNR conditions. Using a realistic head model for both electroencephalography (EEG) and magnetoencephalography (MEG), it is demonstrated that this novel hybrid algorithm enables significant improvements of up to 45% in dipole localization accuracy compared to the often-used dipole scanning and gradient descent techniques. Localization improvements are not only found for single dipoles but also in two-dipole-source scenarios, where sources are proximal to each other. The novel methodology presented in this work could be useful in various applications of clinical neuroimaging, particularly in cases where recordings are noisy or sources are located deep within the brain.