Exhibit
      10.4

    


    STOCK
      PLEDGE AGREEMENT


    


      THIS
      STOCK PLEDGE AGREEMENT (“Agreement”),
      dated
      as of the 2nd
      day of
      July 2007, is by and among ThermoEnergy Corporation, a Delaware corporation
      (the
“Pledgor”),
      in
      favor of Spencer Trask Specialty Group, LLC (in its capacity as agent for itself
      and for other Secured Parties (as defined below), the “Agent”),
      and
      the holders of certain Convertible Promissory Notes due May 31, 2010 in the
      aggregate principal amount of up to $3,700,000 (the “Notes”)
      issued
      by the Pledgor who agree to the terms of this Agreement either by executing
      the
      signature page hereto or by executing a counterpart signature page in the form
      attached as Exhibit
      A
      (the
      “Secured
      Parties”).
      Terms
      used herein and not otherwise defined shall have the same meanings as defined
      in
      the Notes.

    


    WITNESSETH:

    


      WHEREAS,
      (i) on the date hereof, the Secured Parties, the Pledgor and CASTion
      Corporation, a Massachusetts corporation (“CASTion”),
      are
      entering into a transaction whereby the Pledgor is purchasing from the Secured
      Parties certain shares of CASTion’s capital stock (“CASTion Stock”) owned by
      such Secured Parties, and (ii) after the date hereof, the Pledgor will offer
      to
      purchase additional shares of CASTion Stock from other holders; 

    


    WHEREAS,
      as partial payment for the CASTion Stock, the Pledgor is issuing, and will
      issue, the Notes to the Secured Parties; and

    


      WHEREAS,
      the agreement of the Secured Parties to accept the Notes is subject to the
      condition that the Pledgor shall execute and deliver this Agreement and grant
      the security interests hereinafter described in the Pledged Shares (as such
      term
      is defined below);

    


      NOW,
      THEREFORE, in consideration of the Secured Parties’ agreement to accept the
      Notes as partial payment for the CASTion Stock, and for other good and valuable
      consideration, the receipt and sufficiency of which are hereby acknowledged
      by
      the parties hereto, it is hereby agreed as follows:

    


    1. Pledge;
      Deposit.
      

    


    (a) The
      Pledgor hereby pledges and assigns to the Agent, for the benefit of itself
      and
      the Secured Parties, and hereby grants to Agent, for the benefit of itself
      and
      the Secured Parties, a continuing security interest in, (i) each and every
      share
      of CASTion Stock acquired by the Pledgor from any of the Secured Parties, (ii)
      each and every additional share of CASTion Stock which may be acquired after
      the
      date hereof by the Pledgor from any of the Secured Parties, (iii) each and
      every
      additional share of capital stock which may be issued by CASTion after the
      date
      hereof, regardless of the reason for such issuance or the consideration
      therefor, and including shares of capital stock issued with respect to any
      CASTion Stock as a stock dividend or distribution or in connection with any
      stock split, subdivision, recapitalization, reclassification or transaction
      having similar effect after the date hereof, and (iv) all products and proceeds
      of the properties described in the preceding clauses (i) through (iii) (all
      such
      property described in the preceding clauses (i) through (iv) being referred
      to
      hereinafter collectively as the “Pledged
      Shares”),
      as
      security for the due and punctual payment of all amounts owed the Secured
      Parties pursuant to, and the performance of all other obligations of Pledgor
      to
      the Secured Parties under, the Notes or under this Agreement (the “Secured
      Obligations”).

     

    
      
        
        

      

      
        
        

        
          

        

      

      
        
        

      

    

     

    (b) The
      Pledgor hereby deposits the Pledged Shares with the Agent, in form suitable
      for
      transfer by delivery or accompanied by duly executed instruments of transfer
      or
      assignments in blank and any required transfer stamps, and shall, from time
      to
      time, so deposit with the Agent any and all additional Pledged Shares which
      may
      come into its possession.

    


    2.
       Validity.
      The
      Pledgor covenants that the Pledged Shares are duly and validly pledged with
      the
      Agent for the benefit of the Secured Parties in accordance with applicable
      law
      and that the Pledgor will defend the Secured Parties’ right, title and security
      interest in and to the Pledged Shares against the claims and demands of all
      persons whomsoever. The Pledgor represents and warrants to the Agent and to
      the
      Secured Parties that (i) the Pledgor has good title to, and is the sole record
      and beneficial owner of, the Pledged Shares free and clear of all liens, claims,
      security interests and encumbrances of every nature whatsoever except for (x)
      the interest granted to the Agent and the Secured Parties herein and (y) a
      lien
      securing up to $2,000,000 of indebtedness owed by the Pledgor to One Banc &
Trust, N.A. (the “Senior
      Lien”),
      and
      (ii) the Pledgor has obtained all consents and waivers of any third parties
      necessary to permit the grant of the security interests made herein and the
      exercise of the Agent’s and the Secured Parties’ rights under Section 4 and the
      Agent’s right to transfer sole legal and beneficial ownership of the Pledged
      Shares to the Secured Parties on the books of CASTion. 

    


    3.
       No
      Other Transfers or Liens.
      The
      Pledgor hereby covenants and agrees that the Pledgor will not sell, convey
      or
      otherwise dispose of any of the Pledged Shares, nor will the Pledgor create,
      incur or permit to exist any lien, claim, security interest or encumbrance
      whatsoever with respect to any of the Pledged Shares or the proceeds thereof,
      other than (i) the liens on and security interests in the Pledged Shares created
      hereby and (ii) the Senior Lien. 

    


    4.
       Voting;
      Distributions.
      So long
      as there shall exist no Event of Default (as defined in the Notes) or, if there
      shall exist an Event of Default, the Agent shall not have notified the Pledgor
      in writing of its election to exercise the rights of the Secured Parties under
      this Section 4, the Pledgor shall be entitled (i) to exercise the voting power
      with respect to the Pledged Shares as it shall determine to be appropriate
      and
      (ii) to receive cash dividends and other distributions of cash at any time
      and
      from time to time declared or made upon any of the Pledged Shares. In case,
      but
      only so long as, there shall exist an Event of Default, upon the giving of
      the
      written notice to the Pledgor, the Agent shall be entitled (a) to exercise
      the
      voting power with respect to the Pledged Shares as it shall determine to be
      appropriate but for the benefit of the Secured Parties, (b) to receive and
      retain for the benefit of the Secured Parties, as collateral security for the
      Secured Obligations, any and all dividends and other distributions at any time
      and from time to time declared or made upon any of the Pledged Shares, and
      (c)
      to exercise for the benefit of the Secured Parties any and all rights of
      payment, conversion, exchange, subscription or any other rights, privileges
      or
      options pertaining to the Pledged Shares as if it were the absolute owner
      thereof, all without liability except to account for property actually received.
      The Agent shall have no duty to exercise any of the aforesaid rights, privileges
      or options, and shall not be responsible for any failure to do so or delay
      in so
      doing; provided,
      however,
      that
      the Agent shall take, and shall refrain from taking, such actions and shall
      exercise, and shall refrain from exercising, such privileges or options as
      may
      be directed by the Secured Parties then holding Notes the aggregate unpaid
      principal balance of which is at least 75% of the then aggregate unpaid
      principal balance of all Notes (the “Required
      Secured Parties”).
      

     

    
      
        
        

      

      
        2

        
          

        

      

      
        
        

      

    

    


    5.
       Events
      of Default.
      Upon
      the occurrence of any Event of Default (as defined in the Notes), the Agent
      and
      the Secured Parties shall have all of the rights and remedies of secured parties
      under the Uniform Commercial Code as in effect in the Commonwealth of
      Massachusetts or other applicable law. In addition thereto, the Agent and the
      Secured Parties shall have the right, at their election, subject to any
      necessary prior consent of any governmental authority and of the holder of
      the
      Senior Lien, upon notice to the Pledgor, at any time or times thereafter, to
      cause all or any of the Pledged Shares to be transferred into the names of
      the
      Secured Parties or into the names of their nominee or nominees (in full
      satisfaction of the Secured Obligations). In furtherance of all such rights,
      upon the occurrence of any Event of Default, the Agent shall have the right,
      for
      and in the name, place and stead of the Pledgor, and for the benefit of the
      Secured Parties, to execute endorsements, assignments, or other instruments
      of
      conveyance or transfer with respect to all or any of the Pledged Shares. The
      Agent is hereby appointed the attorney-in-fact, with full power of substitution,
      of the Pledgor for the purpose, upon the occurrence of an Event of Default,
      of
      carrying out the provisions of this Agreement and taking any action and
      executing any instruments (including, without limitation, conveyances,
      assignments and transfers) which the Agent may deem necessary or advisable
      to
      accomplish the purposes hereof, which appointment as attorney-in-fact is coupled
      with an interest and is irrevocable. 

    


    The
      Pledgor irrevocably covenants and agrees that it shall not object to any
      transfer or conveyance executed pursuant to the preceding paragraph of this
      Section 5, whether on the grounds that the value of the Pledged Shares at the
      time of the Event of Default exceeds the Secured Obligations or otherwise,
      and
      the Pledgor hereby irrevocably waives, to the fullest extent permissible under
      applicable law, any rights to contest such transfer or conveyance or to recover
      any difference between the value of the Pledged Shares at the time of the Event
      of Default and the Secured Obligations. The Pledgor further acknowledges and
      agrees that the foregoing rights of the Secured Parties and the foregoing
      agreements and waivers are
      material inducements and conditions to the Secured Parties’ willingness to
      accept the Notes and that such agreements and waivers shall not be construed
      as
      a penalty. 

    


    6.
       Rights
      Against the Pledgor; Remedies Cumulative.
      Upon
      the occurrence of any Event of Default, the Agent may, but without obligation
      to
      do so unless so directed by the Required Secured Parties, demand, sue for and/or
      collect any money or property from the Pledgor to which the Secured Parties
      may
      be entitled. No course of dealing between the Pledgor and the Agent or the
      Secured Parties nor any failure to exercise, nor any delay in exercising, on
      the
      part of the Agent or the Secured Parties, any right, power or privilege
      hereunder or under any of the Secured Obligations, shall operate as a waiver
      thereof; nor shall any single or partial exercise of any right, power or
      privilege hereunder or thereunder preclude any other or further exercise thereof
      or the exercise of any other right, power or privilege. The rights and remedies
      herein provided and provided under any of the Secured Obligations are cumulative
      and are in addition to, and not exclusive of, any rights or remedies provided
      by
      law, including, without limitation, the rights and remedies of a secured party
      under the Uniform Commercial Code. 

     

    
      
        
        

      

      
        3

        
          

        

      

      
        
        

      

    

    


    7.
       Assignability
      by the Secured Parties.
      In the
      event of a sale or assignment by any Secured Party of all or any of the Secured
      Obligations held by it, such Secured Party may assign or transfer its rights
      and
      interest under this Agreement in whole or in part to the purchaser or purchasers
      of such Secured Obligations, whereupon such purchaser or purchasers shall become
      vested with all of the powers and rights given to the Secured Party hereunder,
      and such Secured Party shall thereafter be forever released and fully discharged
      from any liability or responsibility hereunder with respect to the rights and
      interests so assigned.

    


    8.
       Return
      and Release of Pledged Shares.
      At such
      time as no principal, interest or other obligations shall be outstanding and
      unpaid under any of the Notes, the Agent and the Secured Parties shall release
      their security interests in the Pledged Shares, and shall deliver the Pledged
      Shares to the Pledgor at the Pledgor’s expense. At the Pledgor’s expense, the
      Agent and the Secured Parties shall execute and deliver such agreements,
      instruments and other writings, and do such other things, as the Pledgor may
      reasonably request in connection with the release of the Secured Party’s
      security interests and the delivery of the Pledged Shares to the Pledgor.


     

    9.
       Duty
      of Care.
      Beyond
      the exercise of reasonable care to assure the safe custody of the Pledged Shares
      while held hereunder, the Agent shall have no duty or liability to collect
      any
      sums due in respect thereof or to protect or preserve rights pertaining thereto,
      and shall be relieved of all responsibility for the Pledged Shares upon
      surrendering the same to the Pledgor. 

    


    
      
        10.
          The
          Agent.

      

    

     

    (a)Each
      Secured Party hereby designates and appoints the Agent as its agent, commencing
      on the date hereof and terminating upon the earlier to occur of the conversion
      of the Notes to equity in accordance with the Notes and the payment of the
      Secured Obligations in full in immediately available funds, for purposes of,
      among other things, collecting, holding and realizing on Pledged Shares for
      the
      benefit of itself and the Secured Parties, perfecting the security interest
      of
      the Agent and the Secured Parties in the Pledged Shares, distributing the
      proceeds of such Pledged Shares and any payments received by Pledgor in
      accordance with the terms hereof, signing all subordination agreements and
      intercreditor agreements as may be reasonably required by the holder of the
      Senior Lien (and carrying out the obligations of the Agent thereunder),
      enforcing the Secured Parties’ rights and remedies (in the Agent’s discretion or
      at the direction of the Required Secured Parties) hereunder and for all other
      acts to be carried out by the Agent (or not carried out by Agent in Agent’s
      discretion) pursuant to the terms hereof. Each Secured Party irrevocably
      authorizes the Agent to exercise all such powers as are expressly delegated
      to
      the Agent hereunder, together with such other powers as are reasonably
      incidental thereto. The Agent (i)
      shall
      have no duties or responsibilities except those expressly set forth in this
      Agreement, and shall not by reason of this Agreement be a trustee or fiduciary
      for any Secured Party; (ii)
      shall
      not be responsible to any Secured Parties for any recitals, statements,
      representations or warranties contained in this Agreement or for the value,
      validity, effectiveness, genuineness, enforceability or sufficiency of this
      Agreement or the Notes or for any other document referred to or provided for
      herein or therein or for any failure by the Pledgor to perform any of its
      obligations hereunder or thereunder; and (iii)
      shall
      not be responsible to the Secured Parties for any action taken or omitted to
      be
      taken by it hereunder or under any other document or instrument referred to or
      provided for herein or in connection herewith, except for its own gross
      negligence or willful misconduct as determined by a final non-appealable
      judgment of a court of competent jurisdiction. The Agent may employ agents
      and
      attorneys-in-fact and shall not be responsible for the negligence or misconduct
      of any such agents or attorneys-in-fact selected by it in good faith. Each
      Secured Party authorizes and directs the Agent to enter into this Agreement
      and
      all subordination agreements and intercreditor agreements executed in connection
      herewith. Each Secured Party agrees that any action taken by the Agent or the
      Required Secured Parties in accordance with the terms of this Agreement, the
      related subordination agreements and intercreditor agreements and the exercise
      by the Agent or the Required Secured Parties of their respective powers set
      forth therein or herein, together with such other powers that are reasonably
      incidental thereto, shall be binding upon all of the Secured
      Parties.

     

    
      
        
        

      

      
        4

        
          

        

      

      
        
        

      

    

    


    (b)As
      to any
      matters not expressly provided for by this Agreement, the Agent shall in all
      cases be fully protected in acting, or in refraining from acting, hereunder
      in
      accordance with instructions given by the Required Secured Parties, and such
      instructions and any action taken or failure to act pursuant thereto shall
      be
      binding on all Secured Parties.

    


    (c) The
      Agent
      shall take such action with respect to any continuing Event(s) of Default as
      shall be directed by the Required Secured Parties to the extent provided for
      herein; provided,
      that,
      unless
      and until the Agent shall have received such directions, the Agent may (but
      shall not be obligated to) take such action, or refrain from taking such action,
      with respect to or by reason of such Event(s) of Default, as it shall deem
      advisable in the best interests of the Secured Parties. Except with the prior
      written consent of the Agent, none of the Secured Parties may assert or exercise
      any enforcement right or remedy in respect of the Secured Obligations or the
      Notes as against the Pledgor or any of the Pledged Shares or other property
      of
      the Pledgor. The Agent shall in all cases be fully justified in failing or
      refusing to act hereunder and thereunder unless it shall receive further
      assurances to its satisfaction from the Secured Parties of their indemnification
      obligations under Section 10(d) hereof against any and all liability and
      expense that may be incurred by it by reason of taking or continuing to take
      any
      such action.

    


    (d) The
      Secured Parties agree to indemnify the Agent (to the extent not reimbursed
      by
      the Pledgor hereunder and without limiting any obligations of the Pledgor
      hereunder) ratably, in accordance with their pro rata share of the Secured
      Obligations, for any and all claims of any kind and nature whatsoever that
      may
      be imposed on, incurred by or asserted against the Agent (including by any
      Secured Party) arising out of or by reason of any investigation in or in any
      way
      relating to or arising out of this Agreement (or the related subordination
      agreements and intercreditor agreements) or any other documents contemplated
      by
      or referred to herein or therein or the transactions contemplated hereby or
      thereby (including any costs and expenses that the Agent is obligated to pay
      hereunder) or the enforcement of any of the terms hereof or thereof or of any
      such other documents, provided,
      that,
      no
      Secured Party shall be liable for any of the foregoing to the extent it arises
      from the gross negligence or willful misconduct of the party to be indemnified
      as determined by a final non-appealable judgment of a court of competent
      jurisdiction. The foregoing indemnity shall survive the payment of the Secured
      Obligations and the termination of this Agreement.

     

    
      
        
        

      

      
        5

        
          

        

      

      
        
        

      

    

    


    (e) The
      Secured Parties hereby irrevocably authorize the Agent, at its option and in
      its
      discretion, to release any security interest in, or lien upon, any of the
      Pledged Shares (i) upon satisfaction of all of the Secured Obligations
      (other than contingent indemnification obligations to the extent no claim giving
      rise thereto has been asserted), or (ii) constituting property being sold
      or disposed of in accordance with Section 5 hereof, or (iii) approved,
      authorized or ratified in writing by all of Secured Parties or (iv) the
      consummation of the conversion of the Notes to equity in accordance with the
      Notes. Except as provided above, the Agent will not release any security
      interest in any of the Pledged Shares without the prior written authorization
      of
      all of the Secured Parties. Upon request by the Agent at any time, the Secured
      Parties will promptly confirm in writing Agent’s authority to release any or all
      of the Pledged Shares pursuant to this Section. The Agent shall have no
      obligation whatsoever to any Secured Party, to confirm or assure that the
      Pledged Shares are owned by Pledgor or has been encumbered, or that the liens
      and security interests granted to the Agent pursuant hereto or otherwise have
      been properly or sufficiently or lawfully created, perfected, protected or
      enforced or are entitled to any particular priority, or to exercise at all
      or in
      any particular manner or under any duty of care, disclosure or fidelity, or
      to
      continue exercising, any of the rights, authorities and powers granted or
      available to the Agent in this Agreement, it being understood and agreed that
      in
      respect of the Pledged Shares, or any act, omission or event related thereto,
      the Agent may act in any manner it may deem appropriate, in its discretion,
      given the Agent’s own interest in the Pledged Shares as a Secured Party and that
      the Agent shall have no duty or liability whatsoever to any other Secured Party.
      Each Secured Party hereby appoints the Agent and each other Secured Party as
      agent and bailee for the purpose of perfecting the security interests in and
      liens upon the Pledged Shares by possession (or where the security interest
      of a
      secured party with possession has priority over the security interest of another
      secured party) and the Agent and each Secured Party hereby acknowledges that
      it
      holds possession of any such Pledged Shares for the benefit of the Agent as
      a
      Secured Party. Should any Secured Party obtain possession of any such Pledged
      Shares, such Secured Party shall notify the Agent thereof, and, promptly upon
      the Agent’s request therefor shall deliver such Pledged Shares to the Agent or
      in accordance with the Agent’s instructions.

    


    11. Notices.
      Any and
      all notices or other communications or deliveries required or permitted to
      be
      provided hereunder shall be in writing and shall be deemed given and effective
      on the earliest of (a) the date of transmission, if such notice or communication
      is delivered via facsimile (provided the sender receives a machine-generated
      confirmation of successful transmission) at the facsimile number specified
      in
      this Section 11, (b) the next business day, if sent by a nationally recognized
      overnight courier service, (c) the second business day after the date of
      mailing, if sent, postage prepaid, by first class U.S. mail or (d) upon actual
      receipt by the party to whom such notice is addressed. The address for such
      notices and communications shall be as follows:

    

      
        	
                If
                  to the Pledgor:

              	
                Dennis
                  C. Cossey, CEO

              
	 	
                ThermoEnergy
                  Corporation

              
	 	
                124
                  West Capitol Avenue, Suite 880

              
	 	
                Little
                  Rock, Arkansas 72201

              
	 	
                Fax:
                  (501) 375-5249

              


      

       

      
        
          
          

        

        
          6

          
            

          

        

        
          
          

        

      

       

      
        	 	 
	
                with
                  copies (which

              	 
	
                shall
                  not constitute

              	 
	
                notice
                  hereunder) to:

              	
                Andrew
                  T. Melton, EVP and CFO

              
	 	
                ThermoEnergy
                  Corporation

              
	 	
                124
                  West Capitol Avenue, Suite 880

              
	 	
                Little
                  Rock, AR 72201

              
	 	
                Fax:
                  (501) 375-5249

              
	 	 
	
                and

              	
                William
                  E. Kelly, Esq.

              
	 	
                Nixon
                  Peabody LLP

              
	 	
                100
                  Summer Street

              
	 	
                Boston,
                  MA 02110

              
	 	
                Fax:
                  (866) 743-4899

              
	 	 
	
                If
                  to the Agent: 

              	
                Donald
                  F. Farley, CEO

              
	 	
                Spencer
                  Trask Specialty Group, LLC

              
	 	
                535
                  Madison Avenue

              
	 	
                New
                  York, NY 10022

              
	 	
                Fax:
                  (508) 854-1753

              
	 	 
	
                with
                  copies (which

              	 
	
                shall
                  not constitute

              	 
	
                notice
                  hereunder) to:

              	
                E.
                  Matthew Gautieri, Controller

              
	 	
                Boston
                  Community Venture Fund

              
	 	
                56
                  Warren Street

              
	 	
                Boston,
                  MA 02119

              
	 	
                Fax:
                  (617) 427-9300

              
	 	 
	 	
                Robert
                  J. Crowley, President

              
	 	
                Massachusetts
                  Technology Development Corporation

              
	 	
                40
                  Broad Street

              
	 	
                Suite
                  818

              
	 	
                Boston,
                  MA 02109

              
	 	
                Fax:
                  (617) 723-5983

              
	 	 
	
                and

              	
                Carl
                  F. Barnes, Esq.

              
	 	
                Morse,
                  Barnes-Brown & Pendleton, P.C.

              
	 	
                1601
                  Trapelo Road

              
	 	
                Waltham,
                  Massachusetts 02451

              
	 	
                Fax:
                  (781) 622-5933

              


      

       

      
        
          
          

        

        
          7

          
            

          

        

        
          
          

        

      

       

      
        	
                If
                  to a Secured Party:

              	
                To
                  such Secured Party at the address of such Secured Party set forth
                  on
                  Exhibit B hereto.

              


      

    

      

    12.
       Waiver
      of Notice, etc.
      The
      Pledgor hereby waives notice of acceptance of this Agreement as well as
      presentment, demand, payment, notice of dishonor or protest and all other
      notices of any kind in connection with any of the Secured Obligations, except
      as
      expressly provided herein. The Pledgor further waives any right it may have
      under any state or federal law to notice except as required hereby or to a
      judicial hearing prior to the exercise of any right or remedy provided by this
      Agreement to the Agent or the Secured Parties and waives its rights, if any,
      to
      set aside or invalidate any sale duly consummated in accordance with this
      Agreement on the grounds (if such be the case) that the sale was consummated
      without a prior judicial hearing. The Pledgor’s waivers under this Section 12
      have been made voluntarily, intelligently and knowingly and after the Pledgor
      has been apprised and counseled by its attorney as to the nature thereof and
      its
      possible alternative rights.

    


    13.
       Reinstatement.
      This
      Agreement shall continue to be effective, or be reinstated, as the case may
      be,
      at any time any amount received by the Secured Parties in respect of the Secured
      Obligations is rescinded or must otherwise be restored or returned to the
      Pledgor upon the insolvency, bankruptcy, dissolution, liquidation or
      reorganization of the Pledgor or upon the appointment of an intervenor or
      conservator of, or trustee or similar official for the Pledgor or any
      substantial part of its properties, or otherwise, all as though such payments
      had not been made.

    


    14.
       Amendments.
      This
      Agreement may be amended and the terms hereof may be waived only with the
      written consent of the Pledgor and the Agent (upon the consent of the Required
      Secured Parties).

    


    15.
       Successors
      and Assigns, etc.
      This
      Agreement shall be binding upon and inure to the benefit of the parties hereto
      and their legal representatives, successors and assigns, and the terms “Secured
      Party” and “Secured Parties” shall be deemed to include any other holder or
      holders of any of the Secured Obligations. Where the content so permits or
      requires, terms defined herein in the singular number shall mean the plural,
      and
      in the plural number, the singular. In case any court of competent jurisdiction
      shall hold any provision of this Agreement to be invalid, illegal or
      unenforceable, the validity, legality and enforceability of the remaining
      provisions shall not in any way be affected or impaired thereby. This Agreement
      may be executed in any number of counterparts, each of which, when so executed
      and delivered, shall be an original, but all of which together shall constitute
      one instrument.

    


    16.
       Governing
      Law.
      This
      Agreement, including the validity hereof and the rights and obligations of
      the
      parties hereunder, shall be construed in accordance with and governed by the
      laws of Commonwealth of Massachusetts and the federal laws of the United States,
      without reference to their conflict of laws provisions. 

     

    
      
        
        

      

      
        8

        
          

        

      

      
        
        

      

    

    


    17. Waiver
      of Right to Trial by Jury.
      THE
      PLEDGOR HEREBY KNOWINGLY, VOLUNTARILY AND INTENTIONALLY WAIVES THE RIGHT TO
      A
      TRIAL BY JURY IN RESPECT OF ANY CLAIM BASED HEREON, ARISING OUT OF, UNDER OR
      IN
      CONNECTION WITH THIS AGREEMENT AND WAIVES ANY RIGHT TO BRING A COUNTERCLAIM
      AGAINST THE AGENT AND/OR AGAINST ANY SECRED PARTY IN ANY ACTION TO ENFORCE
      THIS
      AGREEMENT. THIS WAIVER CONSTITUTES A MATERIAL INDUCEMENT FOR AGENT AND THE
      SECRED PARTIES TO ENTER INTO THIS AGREEMENT.

    


    IN
      WITNESS WHEREOF, the parties hereto have executed this Agreement as a sealed
      instrument as of the date first above written.

    
      	 	 	 
	 	
              “PLEDGOR”

               

              
                THERMOENERGY
                  CORPORATION

              

            
	 
 	 
 	 
 
	
            	By:  	/s/
              Andrew T. Melton
	 	
              
Andrew
              T. Melton
	 	
              Executive
                Vice
                President and 

              
                Chief
                  Financial Officer

              

            


    

     

    
      	 	 	 
	 	
              “AGENT”

               

              
                SPENCER
                  TRASK SPECIALTY GROUP, LLC

              

            
	 
 	 
 	 
 
	
            	By:  	
              /s/ Donald F. Farley

            
	 	
              
                

              

              Name: Donald
                F. Farley

            
	 	Title:
              CEO


    

    


    
      
        
        

      

      
        9

        
          

        

      

      
        
        

      

    

     

    
      	 	 	 
	 	
              “SECURED
                PARTIES”

               

              
                BANCBOSTON
                  VENTURES,
                  INC.

              

            
	 
 	 
 	 
 
	
            	By:  	
              MASSACHUSETTS
                TECHNOLOGY 


              
                DEVELOPMENT  CORPORATION

              

              ATTORNEY-IN-FACT 

            


    

     

    
      	 	 	 
	
            	By:  	/s/
              Robert
              J. Crowley
	 	
              
Name:
Robert
              J. Crowley
	 	Title:
              President


    

     

    
      	 	 	 
	 	
              BCLF
                VENTURES
                I, LLC

            
	 
 	 
 	 
 
	
            	By:  	/s/
              E.
              Matthew Gautieri
              
	 	
              
Name:
E.
              Matthew Gautieri 
	 	Title:
              Controller


    

     

    
      	 	 	 
	 	
              ESSEX
                REGIONAL
                RETIREMENT
                BOARD

            
	 
 	 
 	 
 
	
            	By:  	
              MASSACHUSETTS
                TECHNOLOGY 

              DEVELOPMENTCORPORATION

              ATTORNEY-IN-FACT 

            


    

     

    
      	 	 	 
	
            	By:  	/s/
              Robert
              J. Crowley
	 	
              
Name:
Robert
              J. Crowley
	 	Title:
              President


    

    


    
      
        
        

      

      
        10

        
          

        

      

      
        
        

      

    

     

    
      	 	 	 
	 	
              MASSACHUSETTS
                TECHNOLOGY

              DEVELOPMENT
                CORPORATION

            
	 
 	 
 	 
 
	
            	By:  	/s/
              Robert
              J. Crowley
	 	
              
Name:
Robert
              J. Crowley
	 	Title:
              President


    

     

    
      	 	 	 
	 	
              SPENCER
                TRASK
                SPECIALTY
                GROUP,
                LLC 

            
	 
 	 
 	 
 
	
            	By:  	/s/
              Donald F. Farley
	 	
              
Name:
Donald
              F. Farley
	 	Title:
              CEO


    

    


    
      
        
        

      

      
        11

        
          

        

      

      
        
        

      

    


    EXHIBIT
      A

    


    COUNTERPART
      SIGNATURE PAGE

    


    TO
      STOCK PLEDGE AGREEMENT

    


    Dated
      __________ ____, 2007


    


    _____________
      (the “Additional
      Secured Party”)
      is
      hereby unconditionally joined as a Secured Party to the Stock Pledge Agreement
      dated as of _____________, 2007, as amended from time to time (the “Agreement”),
      and
      agrees that it shall be bound by all terms and conditions applicable to the
      Secured Parties set forth in the Agreement (including, without limitation,
      the
      appointment of the Agent thereunder and all indemnities in connection
      therewith). The Pledgor and the Additional Secured Party hereby agree that
      all
      references to “Secured Parties” set forth in the Agreement shall include the
      Additional Secured Party and the Additional Secured Party shall receive the
      benefit of all of the rights and interests (including, without limitation,
      security interests) of a Secured Party under the Agreement. 

    

      
        	 	
                “ADDITIONAL
                  SECURED PARTY”

                ______________________

                 

              
	 	 	 
	 	
                By:
                  

              	 


      

      
        	 	
                Name:

              	 


      

      
        	 	
                Title:

              	 


      

    

     

    
      	 	 	 
	 	
              “PLEDGOR”

               

              
                THERMOENERGY
                  CORPORATION

              

            
	 
 	 
 	 
 
	
            	By:  	
            
	 	
              
                

              

              Andrew T. Melton

              Executive Vice President and 

            
	 	
              Chief
                Financial Officer

            


    

     

    
      
        
        

      

      
        12

        
          

        

      

      
        
        

      

    

     

    EXHIBIT
      B

    


    Names
      and Addresses of the Secured Parties

     

    BancBoston
      Ventures Inc.

    c/o
      Massachusetts Technology Development Corporation

    40
      Broad
      Street

    Suite
      818

    Boston,
      MA 02109

    Attn:
      Robert J. Crowley, President

    Fax:
      (617) 723-5983


    


    BCLF
      Ventures I, LLC

    c/o
      Boston Community Venture Fund

    56
      Warren
      Street

    Boston,
      MA 02119

    Attn:
      E.
      Matthew Gautieri, Controller

    Fax:
      (617) 427-9300


    


    Essex
      Regional Retirement Board

    c/o
      Massachusetts Technology Development Corporation

    40
      Broad
      Street

    Suite
      818

    Boston,
      MA 02109

    Attn:
      Robert J. Crowley, President

    Fax:
      (617) 723-5983


    


    Massachusetts
      Technology Development Corporation

    40
      Broad
      Street

    Suite
      818

    Boston,
      MA 02109

    Attn:
      Robert J. Crowley, President

    Fax:
      (617) 723-5983


    


    Spencer
      Trask Specialty Group, LLC

    535
      Madison Avenue

    New
      York,
      NY 10022

    Attn:
      Donald F. Farley, CEO

    Fax:
      (508) 854-1753

     

    
      
        
        

      

      
        13

        
          

        

      

      
        
        

      

    

     

    Spencer
      Trask Private Equity Accredited Fund III, LLC

    c/o
      Spencer Trask Specialty Group, LLC

    535
      Madison Avenue

    New
      York,
      NY 10022

    Attn:
      Donald F. Farley, CEO

    Fax:
      (508) 854-1753

    


    
      
        
        

      

      
        14