As the coffee (or any liquid in a container) comes out, a vacuum is created because whatever was in there has left some space. Because we are surrounded by air that has a certain pressure, it will try to push into the cup to fill the space left by the coffee that has been poured out. If there is only one hole, then the air has to try to push past the liquid as it is coming out, because that's the only way the air can get in. This makes the coffee pour out erratically. But if there's another hole for the air to get in, the coffee comes out nicely from its hole and the air goes in nicely through the other hole.
This is why, when you open a can of tomato juice, it's best to make two holes on either side. Similarly, if you look carefully at how the hole is designed in a can of pop, it has an area that extends away from the lips so that pop can come out while air goes in.