I don't want to scare you; but, you need to see a doctor immediately. It sounds like there is an infection in the nail bed. The black colour could indicate gangarene or blood poisoning - either way both are extremely dangerous and could cost you your life if left untreated.
Please go to a doctor immediately and follow all instructions. Good luck!