Using 当然 as an exclamation?
Yes.
In fact, you can use any word as an exclamation, especially in speech. I'm not aware of any language where this is ungrammatical. Example:

Q: What's your favourite Chinese word?
A: 当然！