Scriptures say that a person can get whatever he wants by lighting diya during the evening before Lord Shiva. Like all other beliefs, there is a legend attached to this too.
According to legends, there once lived a very poor person called Gunnidhi. He used to wander in search for food.
One day, he wandered the whole day but couldn't find anything to eat. At dusk he took refuge in an old Shiv temple. As it started getting darker he had no other option but to remove his shirt and burn it.
For this act, Lord Shiva blessed him and Gunnidhi was made kuber the keeper of all the wealth in his next birth.
Hence, it is considered that lighting a diya pleases Lord Shiva and fulfils his devotees wishes.