
<PAGE>   1


                                                                       EXHIBIT 5

             [GABLE GOTWALS MOCK SCHWABE KIHLE GABERINO LETTERHEAD]


                               November 26, 1997


ONEOK, Inc.
100 West Fifth Street
Tulsa, Oklahoma 74103

                             Re: S-8 Registration Statement Under the Securities
                                 Act of 1933, Relating to the Shares of Common
                                 Stock of ONEOK, Inc. in Relation to the ONEOK,
                                 Inc. KGS 401(k) Thrift Plan and Interests of
                                 the Participants in the Plan

Gentlemen:

     We understand that ONEOK, Inc., an Oklahoma corporation (hereinafter
referred to as the "Company"), will file with the Securities and Exchange
Commission under the Securities Act of 1933, as amended, a Form S-8
Registration Statement relating to the registration of Plan interests, and
registration of shares of the Company's Common Stock, $0.01 par value, (the
"Shares") with respect to the ONEOK, Inc. KGS 401(k) Thrift Plan (the "Plan").

     We have examined (a) the above-mentioned Registration Statement which will
be filed with the Securities and Exchange Commission; (b) the Certificate of
Incorporation and Bylaws of the Company, as amended; (c) the ONEOK, Inc. KGS
401(k) Thrift Plan and the corporate actions taken by the Board of Directors in
connection with the Registration Statement and related matters; and (d) such
other corporate records, certificates of public officials and officers of the
Company and other documents as we have considered relevant to the matters
covered by this opinion.

     In connection with the foregoing, as counsel for the Company, we wish to
advise you as follows:
     
                                 

<PAGE>   2
ONEOK, Inc.
November 26, 1997
Page 2


     1.   The Company is a corporation validly organized and existing under the
laws of the State of Oklahoma and is duly qualified to do business as a
corporation in the State of Oklahoma.

     2.   The filing of the above-mentioned Registration Statement has been
duly authorized by the proper corporate action on the part of the Company.

     3.   Assuming the Shares are being issued in compliance with the terms and
conditions of the Plan, when the certificates for the Shares have been executed
by the proper officer of the Company, countersigned by the Transfer Agent and
registered by the Registrar thereof, the certificates for such Shares will
represent, and the Shares will constitute, duly authorized, legally issued,
fully paid, non-assessable, valid and legal shares of the Common Stock of the
Company.

     4.   When an employee of the Company becomes a participant in the Plan,
such employee is thereby entitled to an interest in the Plan according to the
provisions of the Plan and the elections made by the participant from time to
time. Such interests in the Plan, when created in accordance with the
provisions of the Plan, will constitute legally issued, fully paid and
non-assessable interests except as may be set forth in the Plan.

     The statements of law and legal conclusions made in the documents
constituting the prospectus furnished in connection with the Registration
Statement pertaining to the Employee Retirement Income Security Act of 1974, as
amended ("ERISA"), have been reviewed by us and are correct. Where appropriate,
the Plan described in the documents constituting the prospectus has been
amended to comply with ERISA, and in such manner that such Plan, as necessary,
may be qualified under the provisions of the Internal Revenue Code of 1986, as
amended ("Code"). We understand that the Company has submitted a request for
determination of the Plan's qualification under the Code to the Internal
Revenue Service. Subject to that determination, and to the foregoing, it is our
opinion that the written documents comprising the Plan comply with ERISA and
the Code.

     We hereby consent to:

     1.   Being named in the Form S-8 Registration Statement and documents
constituting the prospectus which is being furnished, and in any amendments
thereto, as counsel for the Company, passing on legal matters in connection
with the issuance of the Common Stock to the Trustee under the Plan;

     2.   The making in the Form S-8 Registration Statement and documents
constituting the prospectus, and in any amendments thereto, of the statements
now appearing therein under the caption "interests of Named Experts and
Counsel," insofar as they are applicable to us; and

<PAGE>   3
ONEOK, Inc.
November 26, 1997
Page 3


     3.   The filing of this opinion as an exhibit to the above-mentioned Form
S-8 Registration Statement.

                                        Very truly yours,

                                        GABLE GOTWALS MOCK SCHWABE KIHLE
                                        GABERINO



                                        By /s/ DONALD A. KIHLE
                                           -----------------------------
                                               Donald A. Kihle


  
