The penniless soldier Gherman has fallen in love with Liza, even though she is engaged to his friend Yeletsky. Gherman learns that Liza's guardian the Countess knows a winning three-card formula. Gherman determines to wrest the secret from the Countess, gain a fortune through gambling and marry Liza.

Gherman and Liza admit they love each other, and Gherman persuades Liza to let him into the Countess's room. But when he tries to wrest the Countess's secret from her, she dies of fright. The following evening, the Countess's ghost appears to Gherman. She commands him to marry Liza and tells him the 'secret of the three cards'. But will this help Gherman satisfy his desires or drive him further towards madness?