It could be a bacterial or fungal infection around the nail, nail bed or paw pad. A close physical exam would be needed for a definitive diagnosis. See your veterinarian in the morning. If Cosmo is licking or chewing, place an e-collar (cone) on him until he sees the doctor.