<PAGE>   1
                                                                     EXHIBIT 5.1


July 14, 1998




Board of Directors
Glacier Bancorp, Inc.
202 Main Street
Kalispell, Montana  59903

         RE:      ISSUANCE OF SECURITIES BY GLACIER BANCORP, INC.

Dear Ladies and Gentlemen:

         We are acting as counsel for Glacier Bancorp, Inc., a Delaware
corporation and bank holding company ("Glacier') in connection with the
registration under the Securities Act of 1933, as amended (the "Act") of up to
620,000 shares of Glacier's common stock, $.01 par value per share (the
"Shares") to be issued in accordance with (i) the Plan and Agreement of Merger
(the "Merger Agreement") dated as of December 30, 1997, and amended as of June
30, 1998, between Glacier and HUB Financial Corporation; and (ii) the Agreement
and Plan of Share Exchange ("Share Exchange Agreement") dated as of December 30,
1997, between Glacier and Valley Bank of Helena. A Registration Statement on
Form S-4 ("Registration Statement") is being filed under the Act with respect to
the offering of the Shares pursuant to the Merger Agreement and the Share
Exchange Agreement.

In connection with the offering of the Shares, we have examined (i) the Merger
Agreement; (ii) the Share Exchange Agreement; (iii) the Registration Statement;
and (iv) such other documents as we have deemed necessary to form the opinion
expressed below. As to various questions of fact material to such opinion,
where relevant facts were not independently established, we have relied upon
statements of officers of Glacier or representations and warranties of Glacier
contained in the Merger Agreement and the Share Exchange Agreement. We have
assumed for the purposes of the opinion expressed herein that the transactions
that will be consummated pursuant to the Merger Agreement and the Share
Exchange Agreement are permissible under, and will be consummated in accordance
with, applicable Montana law.
 
         Based upon and relying solely on the foregoing, we advise you that in
our opinion, the Shares, or any portion thereof, when issued pursuant to the
Merger Agreement and the Share Exchange Agreement, after the Registration
Statement has become effective under the Act, will be validly issued under the
laws of the State of Delaware and will be fully paid and nonassessable.

         This opinion letter is limited to the application of the laws of the
State of Delaware and the federal laws of the United States of America, and we
express no opinion as to the laws of any other jurisdictions. 


<PAGE>   2
Board of Directors
Glacier Bancorp Inc.
July 14, 1998
Page 2


Exchange Agreement are permissible under, and will be consummated in accordance
with, applicable Montana law.

         Consent is hereby given to the filing of this opinion as an exhibit to
the Registration Statement and to the legal reference to this firm under the
caption "Certain Legal Matters" as having passed upon the validity of the
Shares. In giving this consent, we do not admit that we are experts within the
meaning of the Act.

                                       Sincerely,

                                       GRAHAM & DUNN

                                       /s/ Graham & Dunn



BEB/beb