After what's now an obvious pullback from the brink of death that banks were staring at earlier this year, plenty of folks think third-quarter bank earnings will come charging back, kicking butts and taking names.

And they may. Factors fueling profits at Goldman Sachs (NYSE:GS) and JPMorgan Chase (NYSE:JPM) -- huge trading gains thanks to the loss of competition post Lehman and Bear Stearns -- are still alive and well. And ultra-low interest rates are still hugely beneficial for more prudent lenders like Wells Fargo (NYSE:WFC).

But one potentially overlooked factor could have a big, ugly, impact on some banks' bottom lines this quarter. Earlier this year, as things hit the fan in unison, an odd accounting rule allowed troubled banks to offset losses at just the right time.

It went like this: As bankruptcy fears loomed, banks' debt plunged in value. As the value of that debt fell, clever accountants assumed banks could repurchase their own debt on the cheap. If they repurchased debt below par, the difference between par and the depressed repurchase price could be booked as profit, since it would be a transfer of wealth from existing bondholders back to the company. Even if the bank had no intention -- or even means -- of repurchasing the debt, it still got to book the spread as income.

Quite literally, the closer banks got to bankruptcy, the higher their accounting profits would become. (This is why your son or daughter shouldn't major in accounting).

But now that panic has evaporated and optimism is back in full bloom, debt spreads are contracting. That means the other side of this insane accounting rule takes hold: As debt spreads contract, the same banks that benefited earlier this year will be forced to book losses.

Who are these banks? Citigroup (NYSE:C) and Bank of America (NYSE:BAC) were two of the biggest beneficiaries of this accounting quirk:

Bank

Q1 Reported Income

Gains from Widening Debt Spreads

Citigroup

$1.6 billion

$2.5 billion

Bank of America

$4.2 billion

$2.2 billion

Already, narrowing credit spreads have come back with a vengeance. Bank of America had to take a $3.6 billion charge in the second quarter thanks to tightening debt spreads (although the loss was masked over by one-time gains from selling assets). Morgan Stanley (NYSE:MS) has been mired in losses all year as its credit spreads improved.

Problem is, credit spreads kept contracting during the latest quarter. The TED spread, for example, has been nearly cut in half since July 1. One-month LIBOR has fallen by about 20%. The LIBOR OIS spread has fallen by 76% since May. All of this is great news for credit markets and the economy in general, but it suggests banks that took advantage of widening spreads earlier this year may cough up big writedowns when they announce earnings this week.

And without offsetting one-time gains from selling assets, investors might discover what the bitterness of actual losses tastes  like again.

For related Foolishness: