Hello and thank you for your question.
If I understand you correctly, you say your tax software both allowed the IRC 179 deduction this year and included it on line 5 of Schedule M-2 after disallowing it last year (and not including it on line 5 of Schedule M-2 last year). That sounds correct.
You also say your Schedule L line 24 matches your balance sheet, which is good because Schedule L is your balance sheet per books so it should.
It sounds like you didn't record the IRC 179 depreciation on your books, which are presumably being kept on a tax basis and so far your AAA account on Schedule M2 has equated to retained earnings per books...
Alternatively, but less likely, you did record the IRC 179 depreciation on your books last year and made an adjustment on Schedule M-1 to reconcile income per books with your taxable income (or your tax software did automatically depending on its settings...). This year, you would again have an adjustment on Schedule M-1 because taxable income would be less than your income per books if taxable income now includes the IRC 179 deduction. Without recording the adjustment this year, Schedule L retained earnings, which most tax software calculates using the net income per books info via Schedule M-1, may be off.
It appears that you expect the ending AAA balance to equal your ending retained earnings balance. Seeing as how the AAA account really has no relationship to your retained earnings per books, I'm not sure there is an issue. Actually, tracking your AAA is just a suggestion in cases where the S-corp has never been a C-corp (thus having no accumulated earnings and profits) as it's not required. The IRS recommends doing it in case the S-corporation ever merges with another S-corp having accumulated earnings and profits, but I digress.
If the above doesn't solve your issue, then without looking at your books and your tax returns it's tough to speculate on what the issue is (if any).
I do hope this is helpful.