<Page>

                                                                     EXHIBIT 5.1

                      [BARACK FERRAZZANO KIRSCHBAUM PERLMAN
                           & NAGELBERG LLC LETTERHEAD]

                                  May 20, 2003

The Board of Directors
Old Second Bancorp, Inc.
37 River Street
Aurora, Illinois 60506-4172


Re:   Old Second Bancorp, Inc.
      Old Second Capital Trust I
      Registration Statement on Form S-3
      ----------------------------------

Ladies and Gentlemen:

     We have acted as counsel to Old Second Bancorp, Inc., a Delaware
corporation (the "Company") and Depositor of Old Second Capital Trust I, a
Delaware statutory trust (the "Trust"), in connection with the preparation of
a Registration Statement on Form S-3 (the "Registration Statement") filed by
the Company and the Trust with the Securities and Exchange Commission under
the Securities Act of 1933, as amended (the "Securities Act"), relating to
(i) the proposed issuance by the Trust of $25,000,000 aggregate Liquidation
Amount of the Trust's ____% Cumulative Trust Preferred Securities due
__________, 2033 (the "Preferred Securities") registered under the Securities
Act; (ii) the Company's ___% Subordinated Debentures to be issued by the
Company to the Trust (the "Debentures") registered under the Securities Act;
and (iii) the Company's guarantee (the "Guarantee"), which guarantees the
payment of distributions and payments on liquidation or redemption of the
Preferred Securities as described therein. The Preferred Securities are
issuable under an Amended and Restated Trust Agreement (the "Trust
Agreement") to be entered into between the Company, as Depositor; Wilmington
Trust Company, a Delaware trust company, as Delaware Trustee and as Property
Trustee; and William B. Skoglund, an individual; J. Douglas Cheatham, an
individual; and Robin Hodgson, an individual, each an Administrative Trustee;
the Debentures are issuable under an indenture (the "Indenture") to be
entered into between the Company and Wilmington Trust Company, as Trustee;
and the Guarantee relates to the Guarantee Agreement (the "Guarantee
Agreement") to be entered into between the Company and Wilmington Trust
Company, as Guarantee Trustee. Capitalized terms used herein and not
otherwise defined herein shall have the meanings assigned to them in the
Trust Agreement, the Indenture and the Guarantee Agreement, as applicable.

     In connection with our rendering the opinions expressed herein, we have
examined originals or copies, certified or otherwise identified to our
satisfaction, of: (i) the certificate of trust filed by the Trust with the
Secretary of State of the State of Delaware on May 12, 2003; (ii) the form of
the Trust Agreement; (iii) the form of the Preferred Securities; (iv) the form
of the Guarantee Agreement; (v) the form of the Debentures; (vi) the form of the
Indenture, in each

<Page>

The Board of Directors
Old Second Bancorp, Inc.
May 20, 2003
Page 2

case in the form filed as an exhibit to the Registration Statement; and (vii)
the Registration Statement. We have also examined originals or copies, certified
or otherwise identified to our satisfaction, of such other documents,
certificates and records and have reviewed such questions of law as we have
considered necessary and appropriate for the purposes of our opinions set forth
below.

     In rendering our opinions, we have assumed, without investigation, the
authenticity of all documents submitted to us as originals, the genuineness of
all signatures and the conformity to authentic originals of all documents
submitted to us as copies. We have also assumed the legal capacity for all
purposes relevant hereto of all natural persons and, with respect to all parties
to agreements or instruments relevant hereto other than the Company and the
Trust, that such parties had the requisite power and authority (corporate or
otherwise) to execute, deliver and perform such agreements or instruments, that
such agreements or instruments have been duly authorized by all requisite action
(corporate or otherwise), executed and delivered by such parties and that such
agreements or instruments are the valid, binding and enforceable obligations of
such parties. In addition, we have assumed that the Trust Agreement, the
Preferred Securities, the Guarantee, the Debentures and the Indenture, when
executed, will be executed in substantially the form reviewed by us. We have
also assumed without verification that, with respect to the minutes of any
meetings of the Board of Directors or any committees thereof of the Company that
we have examined, due notice of the meetings was given or duly waived, the
minutes accurately and completely reflect all actions taken at the meetings and
a quorum was present and acting throughout the meetings. As to questions of fact
material to our opinions, we have relied upon certificates of officers of the
Company and the Trust and of public officials.

     Based on the foregoing, we are of the opinion that:

          (1) The issuance of the Debentures has been duly authorized by all
     requisite corporate action and, when executed and authenticated as
     specified in the Indenture and delivered and paid for in the manner
     described in the Registration Statement, the Debentures will constitute
     valid and binding obligations of the Company, enforceable against the
     Company in accordance with their terms.

          (2) The Guarantee has been duly authorized by all requisite corporate
     action and, when duly executed as specified in the Guarantee Agreement and
     delivered in the manner described in the Registration Statement, the
     Guarantee will constitute the valid and binding obligation of the Company,
     enforceable against the Company in accordance with its terms.

     The opinions set forth above are subject to the following qualifications
and exceptions:

     The enforceability of the operative documents, including, without
limitation, the Debentures and the Guarantee, or any provision thereof,
may be limited by and/or subject to bankruptcy (including, without limitation,
executory contracts provisions), insolvency, reorganization, receivership,
moratorium, fraudulent conveyance or transfer, or other laws affecting the
rights and remedies of creditors generally, or similar federal or state laws, by
general equitable principles, by rules of law governing specific performance,
appointment of

<Page>

The Board of Directors
Old Second Bancorp, Inc.
May 20, 2003
Page 3

receivers, injunctive relief and other equitable remedies, and by remedies or
the exercise of certain rights including, without limitation, commercial
reasonableness or conscionability, reasonable notice of disposition, specific
performance, or enforcement, limitation on sale or encumbrance provisions,
waivers or eliminations of rights such as statutory rights of redemption, or of
jury trial, separation or aggregation of property at foreclosure or enforced
sale, application of sale or judgment proceeds, and multiplicity, inconsistency,
waiver or omission or delay in the enforcement of remedies.

     We are licensed to practice law only in the State of Illinois.

     With respect to matters of Delaware trust law, we are relying upon the
opinion of Richards, Layton & Finger, P.A., Wilmington, Delaware, special
counsel to the Company and the Trust.

     The opinions expressed above concern only the effect of laws as now in
effect and are rendered as of the date hereof. We undertake no, and hereby
disclaim any, obligation to revise or supplement this opinion should such laws
be changed by legislative action, judicial decision or otherwise after the date
of this opinion, or if we become aware of any facts that might change the
opinions expressed above after the date of this letter.

     This opinion letter is limited to the matters stated herein and no opinions
may be implied or inferred beyond the matters expressly stated herein.

     We hereby consent to your filing of this opinion as an exhibit to the
Registration Statement, and to the reference to our firm under the caption
"Legal Matters" contained in the Prospectus included therein.

                                        Very truly yours,

                                        /s/ Barack Ferrazzano Kirschbaum
                                            Perlman & Nagelberg LLC
                                        --------------------------------
                                        BARACK FERRAZZANO KIRSCHBAUM
                                        PERLMAN & NAGELBERG LLC