I've done this same thing before and it can be a prolonged fix. The best end results have come from doing the following. Carefully remove all loose paint, reprime the area, apply drywall mud until level, sand area to wall quality, remove all dust from the wall area, prime, then repaint. This is just my method. Your methods may vary.