Before the revisions of the bankruptcy code in 2005, using a bankruptcy to thwart an eviction and discharge of back rent was pretty simple - it was unsecured debt and was dischargeable like other unsecured debt. For tenants, things were great...but for landlords, not so much.
Treatment of Back Rent under the Bankruptcy Reform Act
Let's see whether the automatic stay even applies.
11 U.S.C. 362 (b)(10) states that it does not apply to "any act by a lessor to the debtor under a lease of nonresidential real property that has terminated by the expiration of the stated term of the lease before the commencement of or during a case under this title to obtain possession of such property." So if it's a non-residential lease, no stay.
So what about residential tenancies?
II U.S.C. (b)(22) states that the stay does NOT apply, "subject to subsection (l), under subsection (a)(3), of the continuation of any eviction...or similar proceeding by a lessor against a debtor involving residential property in which the debtor resides as a tenant under a lease or rental agreement and with respect to which the lessor has obtained before the date of the...the bankruptcy petition, a judgment for possession of such property against the debtor;"
So an emergency filing might not even buy the debtor time before the eviction.
Additional resources provided by the author
This is not the end, however. Unfortunately space is constrained here to go in to further detail, but look at the code and do some research to ensure the bankruptcy will accomplish what you want and need.