The embedded question in
"I cannot remember when was the last time I felt like this before"
if realized as an independent declarative clause, might be, for instance,
"The last time I felt like this before was June."
or, better,
"June was the last time I felt like this before."
The latter is better because English dislikes having long complicated constituents followed by simple short ones -- there are several extraposition-like mechanisms to avoid them. The reason the subject sounds better at the end of the embedded question in your example is this tendency of complex constituents to come toward the end of constructions.
The general rule that you get subject-verb inversion only in independent questions, not in embedded questions, is not violated here, because the movement of the original subject to the end in your example has nothing to do with the clause being a question. It happens also in non-questions, as I've just noted.