BUG: fix SparseArray.unique IndexError and _first_fill_value_loc algo
- [x] closes #47809
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Only on master, whatsnew omitted. Please review #47779 after this merged. Remind that `pd.unique`/`SparseArray` and `np.unique` is not the same. The former one will keep the original order (which is from pd.core.algorithms.unique) and numpy unique will sort the result. cc @mzeitlin11 
Since 1.4.3 and main behave differently, I change the issue title according to the 1.4.3 behavior since it's more closer to the users. In whatsnew, since error on main will not be visible to users, I choose to give the bug description from 1.4.3. Thanks @GYHHAHA! 