Praise be to Allaah.
According to Islaamic Sharee’ah, it is not permitted to keep a dog except within narrowly-defined limits, as the Prophet (peace and blessings of Allaah be upon him) explained: "Whoever keeps a dog, his good deeds will decrease every day by one qeeraat (a unit of measurement), unless it is a dog for farming or herding." According to another report: ". . . unless it is a dog for herding sheep, farming or hunting." (Reported by al-Bukhaari, al-Fath, 2322)
Dogs are extremely naajis (impure, unclean). The Prophet (peace and blessings of Allaah be upon him) said: "If a dog drinks from the vessel of any one of you, let him wash it seven times" (reported by Muslim, no. 279). According to another report: ". . . and clean it the eighth time with earth." (Saheeh Muslim, no. 280).
It is forbidden in Islaam to sell a dog and to receive payment for it, as is reported in Saheeh al-Bukhaari from Abu Mas’oud al-Ansaari: the Messenger of Allaah (peace and blessings of Allaah be upon him) forbade (accepting) the price of a dog. (al-Fath, no. 2237)
The Prophet (peace and blessings of Allaah be upon him) told us not to resemble dogs by placing our forearms on the ground during sujood (prostration), as in reported in the hadeeth narrated by Anas ibn Maalik, according to which the Prophet (peace and blessings of Allaah be upon him) said: "Do sujood properly; none of you should spread his forearms like a dog does." (al-Bukhaari, Fath, no. 822).
Whoever keeps a dog in his house is denied the blessing of the angels’ presence in his house, as the Messenger of Allaah (peace and blessings of Allaah be upon him) said: "The angels do not enter a house in which there is a dog." (Reported by al-Bukhaari, 3225).
Keeping dogs nowadays is the habit of the kuffaar, who adopt them as friends, kiss them, let them lick them and their clothes, sleep with them and even leave them money in their wills. Keeping a dog is an imitation of the kuffaar. Some Muslims may claim that they need to keep a dog at home for purposes of protection, to which we respond that nowadays there are burglar alarm systems and other measures one may take for security purposes, and there is no need to keep a dog, praise be to Allaah.
It only remains for us to say that the fact that it is forbidden to keep a dog and interect closely with it does not mean that we should not be kind or feel compassion towards dogs if we see them in a pitiful state. These are two entirely separate matters. The Prophet (peace and blessings of Allaah be upon him) told us that "a man saw a dog biting the dust because of thirst, so he took his shoe and started to scoop water up with it until the dog’s thirst was quenched. Allaah appreciated his good deed and granted him entry to Paradise for it." (Reported by al-Bukhaari, no. 174).
According to another report, the Prophet (peace and blessings of Allaah be upon him) said: "Whilst a man was walking he became very thirsty, so he went down to a well and drank from it. When he came out, he saw a dog panting and biting the soil because of thirst. The man said, ‘He is suffering the same as I suffered,’ so he filled his shoe (with water), came out and let the dog drink until his thirst was quenched. Allaah appreciated his good deed and forgave him because of it." The people asked, "O Messenger of Allaah, will we be rewarded for how we treat animals?" He said, "In every living thing there is a reward." (Reported by al-Bukhaari, Fath, no. 2363).
We do not want to omit reminding you of the importance of reading the Qur’aan properly and referring to it. You say in your question that the story of the thirsty dog is in the Qur’aan, and that is not the case, as it is reported in the Sunnah.
And Allaah knows best