Place your phone on its screen and blow a hair dryer over the back of the iPhone while it is charging.
Make sure you have something covering the cable that isn't flamable just so the air doesn't heat the cable and mess it up.
While you blow hot air over the back of the phone, your battery will heat up.
Heat causes resistance.
Electrically. V/I+R. Meaning, because heat increases your Resistance, your Resistance + Current will increase your Voltage in the battery.
Increasing your Voltage in the battery just that little bit is needed to trip the Smart Sensor in the Battery to make it believe it isn't dead anymore.
Li-Ions have a silly feature in it where it refuses to take charge anymore if it is completely dead for too long when it is old.
Please do my step as a last resort if you have no warranty, or any other means of repair.
You could always just replace the battery. ;d
Note: Doing my answer will not completely fix your problem.. if you let it drop below 20% it may not want to charge again.