I would answer just slightly differently from the previous post. The people are not, in my mind, the ultimate source of power, but it is important to maintain that illusioni. Ideally of course, in a democracy the people vote to decide their future, but in the case of a representative democracy, like ours with its party system dominated by just two parties, public opinion is more important when it comes to the perception of things rather than actually informing policy decisions, etc.
So political parties must maintain a certain level of positive public opinion but it can be relatively well manipulated through the media and other sources and used to maintain the status quo and allow the representatives to make decisions based on their interests.
Around election time it becomes vital of course, but again, manipulation through the media and various other methods counts for more than any kind of referenda or real reference to public opinion.
Public opinion is important in a democracy because the people are the ultimate source of power. Therefore, any governmental official has to take public opinion into account when deciding how to act.
I am not trying to say that politicians always do what the people want. Clearly, there are a lot of people who are angry with the government, especially right now. But politicians do need to avoid making the majority of the people too unhappy. If they anger enough people badly enough, they will be voted out of office.
So, public opinion is important in a democracy because the people have the right to remove their representatives from office. Therefore, the representatives must at least pay attention to public opinion.
Democracy is often explained as "a government of the people, by the people for the people." In a democracy the rulers are elected by the citizens of a country who are eligible to vote. As such the rulers are answerable to the voting public. Some democratically elected governments even permit to recall the elected representative if he does not satisfy the public which has elected him.
Consequently, public opinion is of paramount importance in a democracy. Freedom of speech and expression is the cornerstone of democracy and the elected representatives had better respond to the needs of the public or else they will be thrown out of power in the next election.