If you lose a filling, you may find yourself in a world of pain. Your tooth will throb, you may even feel pain shooting up and down your jaw and into your head, and you may even have swelling from the nerve being exposed to oxygen. Not to mention that you may get food stuck up in there which may cause further infections and a root canal or even perhaps an extraction, but definitely a worsening of the current condition, which is not too good considering that a filling is already involved.
What you should do is rinse the area immediately with mouthwash and possibly warm water to remove detritus and bits of the filling that may still be in or near the hole. After this is done, take some pain medication. Go to your local pharmacy or drug store, what ever you have near you that sells medical supplies, and buy a bit of temporary filling material. Take it out of the box, add some water (or not, depending on the type. Read the directions!), and roll it into a smallish ball. bite down making sure the ball goes up into your the hole in your tooth. Scrape the rest away, until the surface is smooth and your nerve feels insulated (you will feel it). Leave it to harden and do not eat anything until the putty like material has solidified and is no longer putty like. After this it is imperative that you call your dentist as soon as possible. The temporary filling is temporary, and even if you did a really good job, it will fall out in a matter of days, as it is not meant to last forever. Besides this, the filling falling out may be the result of some greater problem, like a crack in your tooth or like a need for a root canal treatment or something like this.
Certainly do not, under any circumstances think that this can wait. Your tooth is at risk of dying if it is open and painful, as the nerves are becoming affected, and they will die in a matter of time. Also, do not use bubble gum, cotton balls, silly putty or anything else to stuff up the hole, as these are dangerous and can cause more harm than good, not to mention that they cannot be removed and may become toxic. So be careful, use only recommended things especially made for this purpose, as they exist, and go to the dentist as soon as possible!
Register for dental checkup!