
223 B.R. 190 (1998)
In re Larry N. WYTCH and Shirley M. Wytch, Debtors.
Larry N. WYTCH and Shirley M. Wytch, Appellants,
v.
PACIFIC RECONVEYANCE; First Alliance Mortgage Company; Wilson Young; and Al Baldini, Appellees.
BAP Nos. NC-97-1089-RHB, NC-97-1145-RHB, Bankruptcy No. 6-41777-JR, Adversary No. 96-4582.
United States Bankruptcy Appellate Panel of the Ninth Circuit.
Argued and Submitted May 21, 1998.
Decided July 1, 1998.
Larry N. Wytch, Shirley M. Wytch, Oakland, CA, pro se, Appellants.
Spencer P. Scheer, Polk, Scheer & Prober, San Rafael, CA, for First Alliance Mortgage Co.
*191 Velvet A. Chang, Alameda, CA, for Wilson Young and Al Baldini.
Before: RUSSELL, HAGAN, and BRANDT, Bankruptcy Judges.

OPINION
RUSSELL, Bankruptcy Judge.
The appellees' summary judgment motions sought a determination that the bankruptcy court's earlier order annulling the automatic stay validated a foreclosure sale of the debtors' residence. The court granted the summary judgment motions and the debtors appeal. We AFFIRM.

I. FACTS
Larry and Shirley Wytch (the "debtors") filed a voluntary chapter 7[1] petition on March 6, 1996. Less than two hours later, appellee First Alliance Mortgage Company ("FAMCO") held a foreclosure sale of the debtors' residential real property. FAMCO then sold the property to third party purchasers, Al Baldini and Wilson Young (collectively, the "purchasers"), without knowledge of the debtors' bankruptcy filing. FAMCO recorded a Trustee's Deed Upon Sale on March 19, 1996.
FAMCO filed a motion to annul the automatic stay, and the court conducted a hearing on June 7, 1996. On the date of the hearing, the court entered an order that annulled the stay and retroactively validated FAMCO's foreclosure sale of the property and its recordation of the Trustee's Deed Upon Sale. The court stayed the effectiveness of the order to July 8, 1996 and retained jurisdiction to hear "further oral argument if sufficient grounds exists."
The debtors' case was inadvertently dismissed as a result of a clerical error by the court on June 12, 1996, after entry of the order annulling the automatic stay. As a result of the dismissal, the hearing on the motion for relief from the automatic stay scheduled for July 8, 1996 was canceled as moot. The hearing was never rescheduled, and the debtors did not appeal the order granting annulment of the automatic stay. The order dismissing the debtors' case was vacated and the chapter 7 case was reinstated on July 11, 1996.
After the court annulled the stay, the purchasers initiated an unlawful detainer action against the debtors and obtained a judgment against the debtors. The debtors were evicted from their residence on August 27, 1996.
On September 24, 1996, the debtors filed a complaint against both FAMCO and the purchasers that sought to set aside the foreclosure sale. The debtors argued that FAMCO's foreclosure sale and the purchasers' unlawful detainer action violated the automatic stay and such actions were therefore void. The debtors acknowledged in the complaint that the court had issued an order which annulled the stay and validated the sale. Implicit in their complaint, however, was the assertion that the dismissal of their bankruptcy case and its subsequent reinstatement resurrected the automatic stay, notwithstanding the earlier entry of the court's order annulling the stay in the same case.
FAMCO and the purchasers subsequently filed separate motions for summary judgment. FAMCO focused on the fact that the court issued a valid order that annulled the stay and thereby validated the foreclosure sale. The purchasers emphasized the fact that the order was valid and that they exercised their state court remedies after the entry of the order annulling the stay.
The debtors filed a cross-motion for summary judgment and a response to both motions for summary judgment in which they asserted, inter alia, that the foreclosure sale of their residence and the unlawful detainer proceeding were void from the outset because they occurred after the debtors filed bankruptcy. They appeared to contend that under § 349(b), the subsequent dismissal of their bankruptcy case reinstated their property rights as those rights existed prior to bankruptcy and that reinstatement of the bankruptcy case reinstated the automatic stay.
*192 The bankruptcy court granted the motions for summary judgment in favor of FAMCO and the purchasers, and dismissed the debtors' complaint. The debtors appeal.

II. STANDARD OF REVIEW
The Panel reviews de novo the bankruptcy court's grant of summary judgment. In re National Lumber and Supply, Inc., 184 B.R. 74, 77 (9th Cir. BAP 1995); In re Food Catering & Housing, Inc., 971 F.2d 396, 397 (9th Cir.1992). We will affirm the lower court's decision where all the evidence and factual inferences viewed in the light most favorable to the nonmoving party present no genuine issue of material fact. In re Kim, 163 B.R. 157, 159 (9th Cir. BAP 1994), aff'd 62 F.3d 1161 (1995).

III. ISSUE
Whether the bankruptcy court erred as a matter of law in granting the motions for summary judgment in favor of FAMCO and the purchasers.

IV. DISCUSSION
1. The bankruptcy court's order annulling the automatic stay
Although the debtors have appealed the bankruptcy court's grant of FAMCO's and the purchasers' motions for summary judgment, the crux of their appeal actually concerns the bankruptcy court's earlier order that annulled the automatic stay. FAMCO and the purchasers maintain that the stay order is now final and res judicata because the debtors neither contested the merits of the order annulling the stay, nor appealed the order.
The debtors argue on appeal that pursuant to § 349(b), the inadvertent dismissal of their chapter 7 case on June 12, 1996 restored their property rights back to the position in which those rights existed at the commencement of the case. The debtors appear to further argue that the reinstatement of their case on July 11, 1996 also reinstated the automatic stay. They seem to suggest that the dismissal of their case and its subsequent reinstatement started the case anew despite the court's order annulling the automatic stay. Thus, FAMCO's foreclosure sale and the purchasers' subsequent initiation of the state court unlawful detainer proceeding occurred in violation of the stay. We disagree.
Section 349(b) states in part:
(b) Unless the court, for cause, orders otherwise, a dismissal of a case other than under section 742 of this title-
. . .
(2) vacates any order . . . under section 522(i)(1), 542, 550, or 553 of this title; and
(3) revests the property of the estate in the entity in which such property was vested immediately before the commencement of the case under this title.
11 U.S.C. § 349(b).
It is clear that § 349(b) vacates orders under the sections specified in the statute and that a debtor's property rights are restored to the position in which they existed prepetition upon dismissal of a bankruptcy case. The statute does not provide, however, that the dismissal of a case vacates an order issued under § 362(d). Moreover, dismissal does not necessarily "undo" the bankruptcy case where the parties have acquired rights in reliance on the case.
A bankruptcy court's jurisdiction is not always divested upon dismissal of a case. In re Carraher, 971 F.2d 327, 328 (9th Cir. 1992). In addition, "dismissal does not necessarily eliminate the collateral estoppel or res judicata effect that a bankruptcy court decision made during a bankruptcy case has in a later proceeding." In re Serrato, 214 B.R. 219, 227 (Bankr.N.D.Cal.1997) (citing U.S. v. Standard State Bank, 91 B.R. 874 (W.D.Mo.1988), aff'd, 905 F.2d 185 (8th Cir. 1990)).
The doctrine of res judicata "prevents litigation of all grounds for, or defenses to, recovery that were previously available to the parties regardless of whether they were asserted or determined in the prior proceeding." Brown v. Felsen, 442 U.S. 127, 131, 99 S.Ct. 2205, 60 L.Ed.2d 767 (1979). In the proceedings below, the debtors never contested the court's order annulling the automatic *193 stay. It was not until the debtors filed their response to FAMCO's motion for summary judgment that they argued the merits of the order annulling the stay and attempted to show cause why the stay should not have been annulled. The period during which the debtors should have appealed the order had expired long before.
The order annulling the stay is therefore final and is res judicata as to the debtors' claim that the foreclosure sale of their real property was void. The debtors cannot now contest the order granting FAMCO retroactive relief from the automatic stay when the debtors had ample opportunity to do so after the entry of the order annulling the stay.
2. The bankruptcy court's order granting the motions for summary judgment
Summary judgment should be granted if "the pleadings, depositions, answer to interrogatories, and admissions on file, together with the affidavits, if any, show that there is no genuine issue as to any material fact and that the moving party is entitled to judgment as a matter of law." FED. R. CIV. P. 56(c). The court's grant of the motions for summary judgment properly recognized the res judicata effect of its earlier order annulling the stay, reaffirmed the validity of FAMCO's prepetition foreclosure sale as well as the purchasers' postpetition conduct in reliance on the annulment of the stay. The bankruptcy court properly granted summary judgment in favor of FAMCO and the purchasers as a matter of law.

V. CONCLUSION
The chapter 7 debtors never appealed the court's order that annulled the automatic stay. The fact that the debtors' case was dismissed and later reinstated did not vacate that order. Thus, the court's order annulling the stay was res judicata as to the debtors' later claim that the foreclosure sale of their residence was void.
NOTES
[1]  Unless otherwise indicated, all chapter, section and rule references are to the Bankruptcy Code, 11 U.S.C. §§ 101-1330 and the Federal Rules of Bankruptcy Procedure, Rules XXXX-XXXX.
