Stocks have value for two reasons only: 1) their liquidation value (what their assets are worth after subtracting what they owe) and 2) because of the expectation of future earnings.
Regarding 1), it's uncommon for stocks to be valued purely based on their liquidation value since most companies are not meant to be liquidated, but rather to continue as going concerns.
Regarding 2), a stock's history of earnings has no bearing on its future value other than as a proxy for what it could earn in the future. But if the future prospects for a company are really dim, then no glorious history of past earnings can lift the stock much beyond liquidation value.
So what does all of this has to do with recency bias and one-time gains? Well, everything. First, businesses, like life, have their ups and downs. So the recent past might not be a good proxy for judging the future earning power of a company. Even though this is stating the obvious, Wall Street too often forgets this and assigns too much weight to recent events such as improved earnings, one-time gains, a rough patch, etc.
Think about it: The past is bounded, but the future is unbounded. So what a company did last quarter or what it will do next quarter should have close to zero effect on its value in perpetuity.
In summary, when appraising a company, make sure to adjust one-time gains (or charges) and look at earnings over a long period of time (at least 5 years, typically 10 or more) to smooth out recent effects. Averaging the returns after adjusting them can also help you gain a basis for projecting future earnings.
At the same time, make sure to discount recent events that may not have much long-term meaning such as launching new fad products, some types of planned changes in management (especially when a successor has been groomed for many years) and small divestitures or acquisitions of subsidiaries that are unlikely to have a material impact.
When recent changes appear meaningful, ask yourself whether or not they fundamentally change the characteristics of the business on a permanent basis. Is buying that piece of equipment or installing that computer system going to enable the business to earn more or keep more of what it earns permanently in the future? Does it change the nature of the business?