If one’s gums bleed while brushing his or her teeth, it would not break the fast as long as one does not do this intentionally or swallows any blood by on purpose. If one causes his or her gums to bleed and/or swallows the blood, then fasting is broken.
The late prominent Saudi scholar Sheikh Muhammad Al-`Uthaymeen (may Allah bless his soul) states that: The blood that is caused by extracting teeth or nose bleeding does not break the fast on condition that one is cautious as much as he or she can of swallowing the blood. This is based on the fact that unintentional bleeding is not among the things that invalidate the fast. So, whoever bleeds by accident or unintentionally does not need to make up for that day of fasting.