<PAGE>   1

                                                                   EXHIBIT 10.31

                             INTERCREDITOR AGREEMENT

         THIS INTERCREDITOR AGREEMENT (this "Agreement") is made this 16th day
of October, 1997, by and among Virginia R. Cirica Trust (number "1"), Grandview
Trust (number "2"), Ocean Trust (number "3") and Nuvrty, Inc. (number "4"). 1,
2, 3 and 4 have each, as of the date of this Agreement, entered into separate
and independent Term Loan Agreements (the "Loan Agreements") with Diedrich
Coffee, Inc., a Delaware corporation ("Borrower"). 1, 2, 3 and 4 have,
contemporaneously with the execution of their respective Loan Agreements,
received a security interest in substantially all of Borrower's assets. 1
received a security interest, which was perfected by a finan cing statement
filed prior to the filing of the financing statements perfecting the security
interests of 2, 3 and 4. 4 received a security interest, which was perfected by
a financing statement filed prior to the filing of the financing statements
perfecting the security interests of 2 and 3. 1, 2, 3 and 4 desire, however, to
provide that their recoveries from payments under the Loan Agreements and their
recoveries, if necessary following an event of default and foreclosures under
their respective security agreements (entered into in connection with each Loan
Agreement) shall, except as provided herein, be on a pari passu basis.
Accordingly, 1, 2, 3 and 4 have agreed as follows:

         1. Sharing of Payments. 1, 2, 3 or 4 intend that their loans shall be
repaid on a pari passu basis in proportion to the respective principal amounts
of their term loans outstanding at any particular date. Accordingly:

            a. If either 1, 2, 3 or 4 receives, or has received, as of any
specified date, a greater amount of the interest or principal due as of such
date under its Loan Agreement than any other has received, such greater amount
shall be shared with the others, and the party receiving the excess amount shall
be deemed to have received such amount in trust for the others effective as of
the date of such receipt.

            b. If either 1, 2, 3 or 4 forecloses on its security interest in
Borrower's assets, the proceeds of such foreclosure shall be applied first to
pay the costs and expenses of foreclosure and, second, to pay interest due 1, 2,
3 and 4 under their respective Loan Agreements, pro rata in accordance with the
amounts so due. If any


<PAGE>   2

amounts remain thereafter, such amounts shall be applied to pay the principal
outstanding under the loans by 1, 2, 3 and 4, in proportion to the outstanding
principal amounts thereof. If any amounts remain after payment of all principal
and interest on the loans made by 1, 2, 3 and 4, such amounts shall be paid to
Borrower or as otherwise directed by a court of competent jurisdiction.

         2. Cooperation with Respect to Enforcement. 1, 2, 3 and 4 hereby
acknowledge that each of them has made independent loans, based upon its
independent credit judgment with respect to the affairs of Borrower, that they
desire to cooperate in certain respects and that they have no obligation to
cooperate otherwise. Specifically:

            a. 1, 2 and 3 acknowledges that 4 does not have access to all the
information available to 1, 2 and 3 with respect to Borrower. 4 acknowledges
that 1, 2 and 3 have no obligation or duty to disclose to 4 any information in
the possession of 1, 2 or 3 which has not been shared with 4 by Borrower, and
that 1, 2 and 3 shall have no duty to inquire of 4 or of Borrower whether any
information made available to 1, 2 and 3 has been provided to 4. However, 1, 2,
3 and 4 agree to notify each other, at least quarterly, of all amounts collected
from Borrower.

            b. 1, 2, 3 and 4 agree that each party shall have the right
independently, and without consultation with the other, to enforce or waive
specific provisions of its Loan Agreement and to decide to accelerate, if
acceleration is available, to enforce or waive events of default, to foreclose
or not to foreclose upon its respective Security Agreement and otherwise to take
any action with respect to Borrower as it deems appropriate under its respective
Loan Agreement and related documents; and

            c. 1, 2, 3 and 4 hereby agree that if they declare an event of
default or seek to enforce to enforce their rights under their respective
Security Agree ments, they will inform the other parties to this Agreement of
such decision at or about the same time they inform Borrower of their action.

                                       -2-

<PAGE>   3

         3. Disclaimer of Group or Partnership Status.

            a. 1, 2, 3 and 4 hereby disclaim any beneficial ownership in any
stock, warrants or other rights with respect to any securities of Borrower held
by the others and disclaim any intention to act as a "group" within the meaning
of Section 13(d) of the Securities Exchange Act of 1934, as amended, or to act
jointly with respect to any voting, refraining from voting, solicitation of
proxies or giving or withholding of consents with respect to Borrower's
securities.

            b. Neither 1, 2, 3 nor 4 is under any duty or obligation to inform
the other of decisions to exercise, sell, hold or surrender warrants which they
have obtained with respect to their respective Loan Agreements or stock obtained
on exercise thereof.

            c. 1, 2, 3 and 4 disclaim any intent to act as partners, joint
venturers or as part of any common enterprise with respect to lending to
Borrower, holding or disposing of Borrower's securities or taking any other
action.

            d. Neither 1, 2, 3 nor 4 shall be treated as, or shall act as, or
shall hold itself as authorized to act as, an agent of any other.

            e. Except as provided in this Agreement, neither 1, 2, 3 nor 4 has
an obligation, agreement or understanding with respect to Borrower or its debt
or equity securities.

         4. Governing Law. This Agreement shall be governed by and construed in
accordance with the laws of the State of California, including its principles of
law and conflicts of law.

         5. Disputes. Any dispute arising under or in connection with this
Agreement shall be litigated in state or federal courts having a situs in Orange
County, California.

                                       -3-

<PAGE>   4

         6. Construction of Terms. Whenever in this Agreement the masculine or
feminine is used, it shall imply the other gender or the neuter gender, and
references in the singular shall include references in the plural.

         7. No Third Party Benefit. This Agreement is solely for the benefit and
convenience of the parties herein and is not intended to confer any benefits
upon any third party, including without limitation Borrower or any other
creditor of Borrower.

         8. Notices. Any notice required or permitted to be sent under the terms
and provisions of this Agreement shall be effective when delivery by electronic
means has been confirmed, when personal delivery has been accomplished by a
messenger or courier service which provides a proof of receipt, when personally
delivered, or three days after deposit with the United States Postal Service,
postage prepaid. Any such notice shall be sent to the parties at the addresses
shown below:

If to 1:              Virginia R. Cirica Trust
                      Attention: Virginia R. Cirica
                      4515 Tremont Lane
                      Corona Del Mar, California 92625
                      Facsimile (714) 644-9096

With a copy to:       Kraw & Kraw
                      Attention: George Kraw, Esq.
                      333 W. San Carlos, Suite 1050
                      San Jose, California  95110-2711
                      Facsimile (310) 203-7199

If to 2:              Grandview Trust c/o Irell & Manella
                      Attention: Eoien Kreditor, Trustee
                      1800 Avenue of the Stars
                      Los Angeles, California 90067-4276
                      Facsimile (310) 203-7199

With a copy to:       Irell & Manella
                      Attention: Paul Frimmer, Esq.
                      1800 Avenue of the Stars
                      Los Angeles, California 90067-4276
                      Facsimile (310) 203-7199

                                       -4-


<PAGE>   5

If to 3:              Ocean Trust c/o Irell & Manella
                      Attention: Eoien Kreditor, Trustee
                      1800 Avenue of the Stars
                      Los Angeles, California 90067-4276
                      Facsimile (310) 203-7199

With a copy to:       Irell & Manella
                      Attention: Paul Frimmer, Esq.
                      1800 Avenue of the Stars
                      Los Angeles, California 90067-4276
                      Facsimile (310) 203-7199

If to 4:              Nuvrty, Inc.
                      Attention: Amre Youness
                      3 Civic Plaza, Suite 170
                      Newport Beach, California 92660
                      Facsimile (714) 721-8102

With a copy to:       Bernard I. Segal, A Professional Corporation
                      Attention: Bernard Segal, Esq.
                      1900 Avenue of the Stars
                      19th Floor
                      Los Angeles, California 90067

         9. Counterparts. This Agreement may be executed in any number of
counterparts, but all counterparts, by whomever executed, shall be treated as
one and the same instrument.

         10. Amendments and Modifications. This Agreement may be amended or
modified or any its terms or provisions waived only by an instrument in writing
executed by the party against whom enforcement of such change is sought.

                         [SIGNATURES ON FOLLOWING PAGE]

                                       -5-


<PAGE>   6

                   [SIGNATURE PAGE - INTERCREDITOR AGREEMENT]

         IN WITNESS WHEREOF, the parties have executed this Intercreditor
Agreement as of the date first above written.

                                          "1"

                                          Virginia R. Cirica Trust


                                          By: /s/ Virginia R. Cirica
                                              ----------------------------------
                                                  Virginia R. Cirica, Trustee

                                          "2"

                                          Grandview Trust


                                          By: /s/ Eoin Kreditor
                                              ----------------------------------
                                                    Eoin Kreditor, Trustee

                                          "3"

                                          Ocean Trust


                                          By: /s/ Alexa Chappellet
                                              ----------------------------------
                                                     Alexa Chappellet

                                          "4"

                                          Nuvrty, Inc.


                                          By: /s/ Amre Youness
                                              ----------------------------------
                                                  Amre Youness, President

                                       -6-