As underlined by LvW, the Bode stability criterion applies to so-called minimum-phase functions. A minimum-phase function does not host pure delays and no right-half-plane zeroes (RHPZ) or right-half-plane poles (RHPP). If it does, it becomes a non-minimum-phase function and information obtained reading the Bode plot can be misleading. The only way is to resort to the Nyquist plot invoking the Cauchy's argument principle.
In the below example from my APEC 2019 seminar, I have purposely selected a wrong crossover frequency knowing the resonance of the \$LC\$ filter. If the crossover frequency is well below the resonance, you see that the Bode plot is perfect with good phase and gain margins. However, as you observe on the scope, there is some ringing in response to a step:
The problem is coming from the lack of gain at the resonance which is beyond crossover. Remember the sentence for a closed-loop system: no gain, no feedback. The below figure comes from my APEC 2009 seminar and shows that with the previous compensation, the loop is closed in dc up to 100 Hz. Beyond, it operates in ac open-loop conditions and cannot fight the \$LC\$ filter ringing:
As a conclusion, despite nice-looking values in a Bode plot, always apply engineering judgement by considering other approaches like Nyquist for the modulus margin for instance. A plot of the open-loop output impedance would have also probably revealed the abnormal peaking.