meglio I think it only needs to be unique in the application you're using/page you're viewing (it's not stored anywhere), and only if you're bootstrapping it for use inside another bit of software or some widget from Twitter (for examle) that could theoretically use the same attribute.
That's one of the reasons to target it by the element's class:
.PostStream-item ...
so
.PostStream-item[data-index="0"]
That class is reasonably unique to Flarum I think, especially when coupled to that data attribute. You could really make sure though by including a few parent classes in your CSS:
.DiscussionPage .container .DiscussionPage-stream .post-stream .PostStream-item[data-index="0"]
but that would probably be overkill 🙂
Short version: it's pretty safe to use this, yes, but I thought I'd rattle through some examples above in case by some fluke something has the same class names can cause an issue, no matter how unlikely that scenario is.