See "wash sale" rules. But I believe there is one way around it, which may or may not apply to your situation - that is if you sold in one brokerage account, and bought in another. There is apparently a "barrier" between accounts/actions in those multiple accounts. And I think it has to do with brokerage reporting of your trading activity to the IRS - it's done by each broker independently. If this scenario applies, it may work for you.....
Good luck!
SGE